com.intellij.psi.util.PsiElementFilter#com.intellij.openapi.options.ShowSettingsUtil源码实例Demo

下面列出了com.intellij.psi.util.PsiElementFilter#com.intellij.openapi.options.ShowSettingsUtil 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: markdown-image-kit   文件: UploadNotification.java
/**
 * 上传时检查到配置错误时通知
 *
 * @param project    the project
 * @param actionName the action name
 */
public static void notifyConfigurableError(Project project, String actionName) {
    String content = "<p><a href=''>Configure " + actionName + " OSS</a></p><br />";
    content = "<p>You may need to set or reset your account. Please be sure to <b>test</b> it after the setup is complete.</p>" + content + "<br />";
    content = content + "<p>Or you may need <a href='" + HELP_URL + "'>Help</a></p>";
    Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP,
                                              "Configurable Error",
                                              content,
                                              NotificationType.ERROR,
                                              new NotificationListener.Adapter() {
                                                  @Override
                                                  protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                                                      String url = e.getDescription();
                                                      log.trace("{}", e.getDescription());
                                                      if (StringUtils.isBlank(url)) {
                                                          ProjectSettingsPage configurable = new ProjectSettingsPage();
                                                          // 打开设置面板
                                                          ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
                                                      } else {
                                                          BrowserUtil.browse(url);
                                                      }
                                                      hideBalloon(notification.getBalloon());
                                                  }
                                              }), project);
}
 
源代码2 项目: markdown-image-kit   文件: UploadNotification.java
/**
 * 上传失败通知, 可打开设置面板
 * 文件链接, 帮助链接, 设置链接
 * todo-dong4j : (2019年03月23日 15:14) [{@link com.intellij.openapi.fileTypes.impl.ApproveRemovedMappingsActivity}]
 *
 * @param e       the e
 * @param project the project
 */
public static void notifyUploadFailure(UploadException e, Project project) {
    String details = e.getMessage();
    String content = "<p><a href=\"\">Configure oss...</a></p>";
    if (StringUtil.isNotEmpty(details)) {
        content = "<p>" + details + "</p>" + content;
    }
    Notifications.Bus.notify(new Notification(MIK_NOTIFICATION_GROUP, "Upload Failured",
                                              content, NotificationType.ERROR,
                                              (notification, event) -> {
                                                  ProjectSettingsPage configurable = new ProjectSettingsPage();
                                                  // 打开设置面板
                                                  ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
                                                  // 点击超链接后关闭通知
                                                  if (event.getEventType().equals(HyperlinkEvent.EventType.ENTERED)) {
                                                      notification.hideBalloon();
                                                  }
                                              }), project);
}
 
源代码3 项目: leetcode-editor   文件: AbstractAction.java
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    Config config = PersistentConfig.getInstance().getInitConfig();
    if (config == null) {
        MessageUtils.getInstance(anActionEvent.getProject()).showWarnMsg("warning", PropertiesUtils.getInfo("config.first"));
        ShowSettingsUtil.getInstance().showSettingsDialog(anActionEvent.getProject(), SettingConfigurable.DISPLAY_NAME);
        return;
    } else if (StringUtils.isBlank(config.getId())) {
        config.setId(MTAUtils.getI(""));
        PersistentConfig.getInstance().setInitConfig(config);
    }

    try {
        MTAUtils.click(anActionEvent.getActionManager().getId(this), config);
        UpdateUtils.examine(config, anActionEvent.getProject());
    } catch (Exception e) {
    }

    ProgressManager.getInstance().run(new Task.Backgroundable(anActionEvent.getProject(),anActionEvent.getActionManager().getId(this),false) {
        @Override
        public void run(@NotNull ProgressIndicator progressIndicator) {
            actionPerformed(anActionEvent, config);
        }
    });

}
 
源代码4 项目: EasyCode   文件: TableInfoServiceImpl.java
/**
 * 类型校验,如果存在未知类型则引导用于去条件类型
 *
 * @param dbTable 原始表对象
 * @return 是否验证通过
 */
@Override
public boolean typeValidator(DbTable dbTable) {
    // 处理所有列
    JBIterable<? extends DasColumn> columns = DasUtil.getColumns(dbTable);
    List<TypeMapper> typeMapperList = CurrGroupUtils.getCurrTypeMapperGroup().getElementList();

    FLAG:
    for (DasColumn column : columns) {
        String typeName = column.getDataType().getSpecification();
        for (TypeMapper typeMapper : typeMapperList) {
            // 不区分大小写查找类型
            if (Pattern.compile(typeMapper.getColumnType(), Pattern.CASE_INSENSITIVE).matcher(typeName).matches()) {
                continue FLAG;
            }
        }
        // 没找到类型,引导用户去添加类型
        if (MessageDialogBuilder.yesNo(MsgValue.TITLE_INFO, String.format("数据库类型%s,没有找到映射关系,是否去添加?", typeName)).isYes()) {
            ShowSettingsUtil.getInstance().showSettingsDialog(project, "Type Mapper");
            return false;
        }
        // 用户取消添加
        return true;
    }
    return true;
}
 
源代码5 项目: azure-devops-intellij   文件: IdeaHelper.java
/**
 * Verifies if TF is configured, show notification and warning message if not
 *
 * @param project Idea project
 * @return true if TF is configured, false if TF is not correctly configured
 */
public static boolean isTFConfigured(@NotNull final Project project) {
    String tfLocation = TfTool.getLocation();
    if (StringUtils.isEmpty(tfLocation)) {
        tfLocation = TfTool.tryDetectTf();
        if (!StringUtils.isEmpty(tfLocation)) {
            PluginServiceProvider.getInstance().getPropertyService().setProperty(PropertyService.PROP_TF_HOME, tfLocation);
            return true;
        }
        //TF is not configured, show warning message
        int result = Messages.showDialog(project,
                TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOT_CONFIGURED),
                TfPluginBundle.message(TfPluginBundle.KEY_TFVC),
                new String[] {
                        TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOT_CONFIGURED_DIALOG_OPEN_SETTINGS),
                        TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOT_CONFIGURED_DIALOG_CANCEL)},
                0, getWarningIcon());
        if (result == 0) {
            ShowSettingsUtil.getInstance().showSettingsDialog(project, TFSVcs.TFVC_NAME);
        }
        return false;
    }

    return true;
}
 
public ReviewBoardClient() throws Exception {
    String server = ReviewBoardSettings.getSettings().getState().server;
    if (server == null||server.trim().isEmpty()) {
        Messages.showMessageDialog((Project)null, "Please set the review board server address in config panel", "Info", null);
        ShowSettingsUtil.getInstance().showSettingsDialog(null, ReviewBoardSettings.SETTING_NAME);
        throw new Exception("Please set the review board server address in config panel");
    }

    this.apiUrl = server + "/api/";
    String cookie = ReviewBoardSettings.getSettings().getState().cookie;
    if(cookie==null){
        cookie = ReviewBoardSettings.getSettings().getRBSession(server);
        if(cookie==null){
            throw new Exception("Login failed.");
        }
    }
    this.rbCookie = cookie;
}
 
@Override
public void hyperlinkUpdate(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
  if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    final String description = event.getDescription();
    if ("enable".equals(description)) {
      KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true);
    }
    else if ("settings".equals(description)) {
      final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
      IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
      //util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true));
      util.showSettingsDialog(ideFrame.getProject(), KeymapPanel.class);
    }

    NotificationsConfiguration.getNotificationsConfiguration().changeSettings(LOCALIZATION_GROUP_DISPLAY_ID, NotificationDisplayType.NONE, false, false);
    notification.expire();
  }
}
 
源代码8 项目: consulo   文件: BrowserLauncherImpl.java
@Override
protected void doShowError(@Nullable final String error, @Nullable final WebBrowser browser, @Nullable final Project project, final String title, @Nullable final Runnable launchTask) {
  AppUIUtil.invokeOnEdt(new Runnable() {
    @Override
    public void run() {
      if (Messages.showYesNoDialog(project, StringUtil.notNullize(error, "Unknown error"), title == null ? IdeBundle.message("browser" + ".error") : title, Messages.OK_BUTTON,
                                   IdeBundle.message("button.fix"), null) == Messages.NO) {
        final BrowserSettings browserSettings = new BrowserSettings();

        AsyncResult<Void> result = ShowSettingsUtil.getInstance().editConfigurable(project, browserSettings, browser == null ? null : (Runnable)() -> browserSettings.selectBrowser(browser));
        result.doWhenDone(() -> {
          if (launchTask != null) {
            launchTask.run();
          }
        });
      }
    }
  }, project == null ? null : project.getDisposed());
}
 
源代码9 项目: consulo   文件: DvcsBranchPopup.java
private void notifyAboutSyncedBranches() {
  String description = "You have several " +
                       myVcs.getDisplayName() +
                       " roots in the project and they all are checked out at the same branch. " +
                       "We've enabled synchronous branch control for the project. <br/>" +
                       "If you wish to control branches in different roots separately, " +
                       "you may <a href='settings'>disable</a> the setting.";
  NotificationListener listener = new NotificationListener() {
    @Override
    public void hyperlinkUpdate(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
      if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        ShowSettingsUtil.getInstance().showSettingsDialog(myProject, myVcs.getConfigurable().getDisplayName());
        if (myVcsSettings.getSyncSetting() == DvcsSyncSettings.Value.DONT_SYNC) {
          notification.expire();
        }
      }
    }
  };
  VcsNotifier.getInstance(myProject).notifyImportantInfo("Synchronous branch control enabled", description, listener);
}
 
源代码10 项目: consulo   文件: VcsRootProblemNotifier.java
@Override
protected void hyperlinkActivated(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
  if (event.getDescription().equals("configure") && !myProject.isDisposed()) {
    ShowSettingsUtil.getInstance().showSettingsDialog(myProject, ActionsBundle.message("group.VcsGroup.text"));
    Collection<VcsRootError> errorsAfterPossibleFix = getInstance(myProject).scan();
    if (errorsAfterPossibleFix.isEmpty() && !notification.isExpired()) {
      notification.expire();
    }
  }
  else if (event.getDescription().equals("ignore")) {
    mySettings.addIgnoredUnregisteredRoots(ContainerUtil.map(myImportantUnregisteredRoots, PATH_FROM_ROOT_ERROR));
    notification.expire();
  }
  else if (event.getDescription().equals("add")) {
    List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
    for (VcsRootError root : myImportantUnregisteredRoots) {
      mappings = VcsUtil.addMapping(mappings, root.getMapping(), root.getVcsKey().getName());
    }
    myVcsManager.setDirectoryMappings(mappings);
  }
}
 
public static AsyncResult<Void> editToolSettings(final Project project,
                                           final InspectionProfile inspectionProfile,
                                           final boolean canChooseDifferentProfile,
                                           final String selectedToolShortName) {
  final ShowSettingsUtil settingsUtil = ShowSettingsUtil.getInstance();
  final ErrorsConfigurable errorsConfigurable;
  if (!canChooseDifferentProfile) {
    errorsConfigurable = new IDEInspectionToolsConfigurable(InspectionProjectProfileManager.getInstance(project), InspectionProfileManager.getInstance());
  }
  else {
    errorsConfigurable = ErrorsConfigurable.SERVICE.createConfigurable(project);
  }
  return settingsUtil.editConfigurable(project, errorsConfigurable, new Runnable() {
    @Override
    public void run() {
      errorsConfigurable.selectProfile(inspectionProfile);
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          errorsConfigurable.selectInspectionTool(selectedToolShortName);
        }
      });
    }
  });

}
 
源代码12 项目: consulo   文件: ChangeTemplateDataLanguageAction.java
@Override
public void actionPerformed(final AnActionEvent e) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) return;

  final VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
  final TemplateDataLanguageConfigurable configurable = new TemplateDataLanguageConfigurable(project);
  ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {
    @Override
    public void run() {
      if (virtualFile != null) {
        configurable.selectFile(virtualFile);
      }
    }
  });
}
 
源代码13 项目: consulo   文件: SetTodoFilterAction.java
public static DefaultActionGroup createPopupActionGroup(final Project project,
                                                        final TodoPanelSettings settings,
                                                        Consumer<TodoFilter> todoFilterConsumer) {
  TodoFilter[] filters = TodoConfiguration.getInstance().getTodoFilters();
  DefaultActionGroup group = new DefaultActionGroup();
  group.add(new TodoFilterApplier(IdeBundle.message("action.todo.show.all"),
                                  IdeBundle.message("action.description.todo.show.all"), null, settings, todoFilterConsumer));
  for (TodoFilter filter : filters) {
    group.add(new TodoFilterApplier(filter.getName(), null, filter, settings, todoFilterConsumer));
  }
  group.addSeparator();
  group.add(
          new AnAction(IdeBundle.message("action.todo.edit.filters"),
                       IdeBundle.message("action.todo.edit.filters"), AllIcons.General.Settings) {
            @Override
            public void actionPerformed(AnActionEvent e) {
              final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
              util.editConfigurable(project, new TodoConfigurable());
            }
          }
  );
  return group;
}
 
源代码14 项目: consulo   文件: GotoActionAction.java
private static void openOptionOrPerformAction(Object element, String enteredText, @Nullable Project project, Component component, @JdkConstants.InputEventMask int modifiers) {
  if (element instanceof OptionDescription) {
    OptionDescription optionDescription = (OptionDescription)element;
    String configurableId = optionDescription.getConfigurableId();
    Disposable disposable = project != null ? project : ApplicationManager.getApplication();
    TransactionGuard guard = TransactionGuard.getInstance();
    if (optionDescription.hasExternalEditor()) {
      guard.submitTransactionLater(disposable, () -> optionDescription.invokeInternalEditor());
    }
    else {
      guard.submitTransactionLater(disposable, () -> ShowSettingsUtil.getInstance().showSettingsDialog(project, configurableId, enteredText));
    }
  }
  else {
    ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(() -> performAction(element, component, null, modifiers, null)));
  }
}
 
源代码15 项目: flutter-intellij   文件: IdeaFrameFixture.java
@NotNull
public IdeSettingsDialogFixture openIdeSettings() {
  // Using invokeLater because we are going to show a *modal* dialog via API (instead of clicking a button, for example.) If we use
  // GuiActionRunner the test will hang until the modal dialog is closed.
  ApplicationManager.getApplication().invokeLater(
    () -> {
      Project project = getProject();
      ShowSettingsUtil.getInstance().showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true));
    });
  IdeSettingsDialogFixture settings = IdeSettingsDialogFixture.find(robot());
  robot().waitForIdle();
  return settings;
}
 
@Nullable
private static EditorNotificationPanel createUpdateDartPanel(@NotNull Project project,
                                                             @Nullable Module module,
                                                             @NotNull String currentVersion,
                                                             @NotNull String minimumVersion) {
  if (module == null) return null;

  final EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(FlutterBundle.message("flutter.incompatible.dart.plugin.warning", minimumVersion, currentVersion));
  panel.createActionLabel(FlutterBundle.message("dart.plugin.update.action.label"),
                          () -> ShowSettingsUtil.getInstance().showSettingsDialog(project, PluginManagerConfigurable.class));

  return panel;
}
 
@Nullable
private static EditorNotificationPanel createUpdateDartPanel(@NotNull Project project,
                                                             @Nullable Module module,
                                                             @NotNull String currentVersion,
                                                             @NotNull String minimumVersion) {
  if (module == null) return null;

  final EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(FlutterBundle.message("flutter.incompatible.dart.plugin.warning", minimumVersion, currentVersion));
  panel.createActionLabel(FlutterBundle.message("dart.plugin.update.action.label"),
                          () -> ShowSettingsUtil.getInstance().showSettingsDialog(project, PluginManagerConfigurable.class));

  return panel;
}
 
源代码18 项目: intellij   文件: SdkUtil.java
/** Opens the SDK manager settings page */
public static void openSdkManager() {
  Configurable configurable =
      ConfigurableExtensionPointUtil.createApplicationConfigurableForProvider(
          SdkUpdaterConfigurableProvider.class);
  ShowSettingsUtil.getInstance().showSettingsDialog(null, configurable.getClass());
}
 
public final void actionPerformed(@NotNull AnActionEvent event) {
    if((event.getModifiers() & MouseEvent.ALT_MASK) != 0) {
        ShowSettingsUtil.getInstance().showSettingsDialog(event.getProject(), AEMPluginConfiguration.DISPLAY_NAME);
    } else {
        boolean state = !this.isSelected(event);
        this.setSelected(event, state);
        Presentation presentation = event.getPresentation();
        presentation.putClientProperty("selected", state);
    }
}
 
private static void showNoVsClientDialog(@Nullable Project project) {
    ApplicationManager.getApplication().assertIsDispatchThread();

    Messages.showErrorDialog(
            project,
            TfPluginBundle.message(TfPluginBundle.KEY_TFVC_SETTINGS_VS_CLIENT_PATH_EMPTY),
            TfPluginBundle.message(TfPluginBundle.KEY_TFVC_IMPORT_WORKSPACE_TITLE));
    ShowSettingsUtil.getInstance().showSettingsDialog(project, TFSVcs.TFVC_NAME);
}
 
public void refreshReviews() {
    view.enablePanel(false);
    TaskUtil.queueTask(project, "Loading review", false, new ThrowableFunction<ProgressIndicator, Page<Review>>() {
        @Override
        public Page<Review> throwableCall(final ProgressIndicator progressIndicator) throws Exception {

            try {
                final String username = ReviewDataProvider.getConfiguration(project).username;
                final String fromUser = reviewListFilter == ReviewListFilter.OUTGOING ? username : null;
                final String toUser = reviewListFilter == ReviewListFilter.INCOMING ? username : null;

                reviews = ReviewDataProvider.getInstance(project).listReviews(fromUser, toUser, status, repositoryId
                        , start, count);
                view.setReviewsList(start / COUNT + 1, reviews.getResult());
                view.enablePanel(true);
                return reviews;
            } catch (InvalidConfigurationException e) {
                ApplicationManager.getApplication().invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        ShowSettingsUtil.getInstance().showSettingsDialog(project, SettingsPage.SETTINGS_DISPLAY_NAME);
                    }
                });
                throw e;
            }
        }
    }, null, null);
}
 
private void startOptionsEdit() {
  final Runnable action = new Runnable() {
    @Override
    public void run() {
      ShowSettingsUtil.getInstance().showSettingsDialog(editor.getProject(), MindMapSettingsComponent.DISPLAY_NAME);
    }
  };

  if (!IdeaUtils.submitTransactionLater(action)) {
    SwingUtilities.invokeLater(action);
  }
}
 
/**
 * Shows the settings dialog when the user presses "configure" on a balloon.
 */
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
    if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        if (event.getDescription().equals("configureHaskellTools") && !myProject.isDisposed()) {
            ShowSettingsUtil.getInstance().showSettingsDialog(myProject, HaskellToolsConfigurable.HASKELL_TOOLS_ID);
            notification.expire();
        }
    }
}
 
@Override
protected void hyperlinkActivated(@NotNull final Notification notification, @NotNull final HyperlinkEvent e) {

  if (!project.isDisposed()) {
    ShowSettingsUtil.getInstance().showSettingsDialog(project, nameToSelect);
  }
}
 
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent hyperlinkEvent) {
    if(hyperlinkEvent.getDescription().equals("disable"))
    {
        ServiceManager.getService(project, DojoSettings.class).setNeedsMoreDojoEnabled(false);
        notification.hideBalloon();

        new Notification("needsmoredojo",
                "Needs More Dojo: Setup Sources",
                "Needs More Dojo has been disabled. To re-enable it, open the Needs More Dojo settings",
                NotificationType.WARNING, new SetupNotification()).notify(project);
    }
    else if(hyperlinkEvent.getDescription().equals("turnoff"))
    {
        ServiceManager.getService(project, DojoSettings.class).setSetupWarningDisabled(true);
        notification.hideBalloon();

        new Notification("needsmoredojo",
                "Needs More Dojo: Setup Sources",
                "You will no longer be asked to set up your sources for this project. You can re-enable the warning in the Needs More Dojo settings.",
                NotificationType.WARNING, new SetupNotification()).notify(project);
    }
    else
    {
        ShowSettingsUtil.getInstance().showSettingsDialog(project, "Needs More Dojo");
    }
}
 
源代码26 项目: consulo   文件: CoverageLineMarkerRenderer.java
@Override
public void actionPerformed(AnActionEvent e) {
  final ColorAndFontOptions colorAndFontOptions = new ColorAndFontOptions(){
    @Override
    protected List<ColorAndFontPanelFactory> createPanelFactories() {
      final GeneralColorsPage colorsPage = new GeneralColorsPage();
      final ColorAndFontPanelFactory panelFactory = new ColorAndFontPanelFactory() {
        @Nonnull
        @Override
        public NewColorAndFontPanel createPanel(@Nonnull ColorAndFontOptions options) {
          final SimpleEditorPreview preview = new SimpleEditorPreview(options, colorsPage);
          return NewColorAndFontPanel.create(preview, colorsPage.getDisplayName(), options, null, colorsPage);
        }

        @Nonnull
        @Override
        public String getPanelDisplayName() {
          return "Editor | " + getDisplayName() + " | " + colorsPage.getDisplayName();
        }
      };
      return Collections.singletonList(panelFactory);
    }
  };
  final Configurable[] configurables = colorAndFontOptions.buildConfigurables();
  try {
    final SearchableConfigurable general = colorAndFontOptions.findSubConfigurable(GeneralColorsPage.class);
    if (general != null) {
      final LineData lineData = getLineData(myLineNumber);
      ShowSettingsUtil.getInstance().editConfigurable(myEditor.getProject(), general,
                                                      general.enableSearch(getAttributesKey(lineData).getExternalName()));
    }
  }
  finally {
    for (Configurable configurable : configurables) {
      configurable.disposeUIResources();
    }
    colorAndFontOptions.disposeUIResources();
  }
}
 
源代码27 项目: consulo   文件: IOExceptionDialog.java
@Nonnull
@Override
protected Action[] createLeftSideActions() {
  return new Action[] {
    new AbstractAction(CommonBundle.message("dialog.ioexception.proxy")) {
      @Override
      public void actionPerformed(@Nonnull ActionEvent e) {
        ShowSettingsUtil.getInstance().editConfigurable(ObjectUtil.tryCast(e.getSource(), JComponent.class), new HttpProxyConfigurable());
      }
    }
  };
}
 
源代码28 项目: consulo   文件: BrowserSelector.java
public BrowserSelector(@Nonnull final Condition<WebBrowser> browserCondition) {
  myModel = createBrowsersComboModel(browserCondition);
  myBrowserComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox(myModel));
  myBrowserComboWithBrowse.addActionListener(e -> {
    WebBrowserManager browserManager = WebBrowserManager.getInstance();
    long modificationCount = browserManager.getModificationCount();
    ShowSettingsUtil.getInstance().editConfigurable(myBrowserComboWithBrowse, new BrowserSettings());

    WebBrowser selectedItem = getSelected();
    if (modificationCount != browserManager.getModificationCount()) {
      myModel = createBrowsersComboModel(browserCondition);
      //noinspection unchecked
      myBrowserComboWithBrowse.getComboBox().setModel(myModel);
    }
    if (selectedItem != null) {
      setSelected(selectedItem);
    }
  });

  //noinspection unchecked
  myBrowserComboWithBrowse.getComboBox().setRenderer(SimpleListCellRenderer.<WebBrowser>create((label, value, index) -> {
    Image baseIcon;
    if (value == null) {
      WebBrowser firstBrowser = WebBrowserManager.getInstance().getFirstActiveBrowser();
      baseIcon = firstBrowser == null ? AllIcons.Nodes.PpWeb : firstBrowser.getIcon();
    }
    else {
      baseIcon = value.getIcon();
    }
    label.setIcon(TargetAWT.to(myBrowserComboWithBrowse.isEnabled() ? baseIcon : ImageEffects.grayed(baseIcon)));
    label.setText(value != null ? value.getName() : "Default");
  }));
}
 
源代码29 项目: consulo   文件: ChangelistConflictDialog.java
@Nonnull
@Override
protected Action[] createLeftSideActions() {
  return new Action[] { new AbstractAction("&Configure...") {
    public void actionPerformed(ActionEvent e) {
      ChangeListManagerImpl manager = (ChangeListManagerImpl)ChangeListManager.getInstance(myProject);
      ShowSettingsUtil.getInstance().editConfigurable(myPanel, new ChangelistConflictConfigurable(manager));
    }
  }};
}
 
private ChangelistConflictNotificationPanel(ChangelistConflictTracker tracker, VirtualFile file, LocalChangeList changeList) {
  myTracker = tracker;
  myFile = file;
  final ChangeListManager manager = tracker.getChangeListManager();
  myChangeList = changeList;
  myLabel.setText("File from non-active changelist is modified");
  createActionLabel("Move changes", () -> ChangelistConflictResolution.MOVE.resolveConflict(myTracker.getProject(), myChangeList.getChanges(), myFile)).
          setToolTipText("Move changes to active changelist (" + manager.getDefaultChangeList().getName() + ")");

  createActionLabel("Switch changelist", () -> {
    Change change = myTracker.getChangeListManager().getChange(myFile);
    if (change == null) {
      Messages.showInfoMessage("No changes for this file", "Message");
    }
    else {
      ChangelistConflictResolution.SWITCH.resolveConflict(myTracker.getProject(), Collections.singletonList(change), null);
    }
  }).setToolTipText("Set active changelist to '" + myChangeList.getName() + "'");

  createActionLabel("Ignore", () -> myTracker.ignoreConflict(myFile, true)).setToolTipText("Hide this notification");

  myLinksPanel.add(new InplaceButton("Show options dialog", AllIcons.General.Settings, new ActionListener() {
    public void actionPerformed(ActionEvent e) {

      ShowSettingsUtil.getInstance().editConfigurable(myTracker.getProject(),
                                                      new ChangelistConflictConfigurable((ChangeListManagerImpl)manager));
    }
  }));
}