com.intellij.openapi.options.ShowSettingsUtil Java Examples

The following examples show how to use com.intellij.openapi.options.ShowSettingsUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UploadNotification.java    From markdown-image-kit with MIT License 7 votes vote down vote up
/**
 * 上传时检查到配置错误时通知
 *
 * @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);
}
 
Example #2
Source File: ReviewBoardClient.java    From reviewboard-plugin-for-idea with MIT License 6 votes vote down vote up
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;
}
 
Example #3
Source File: EditInspectionToolsSettingsAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
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);
        }
      });
    }
  });

}
 
Example #4
Source File: VcsRootProblemNotifier.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example #5
Source File: IdeaHelper.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: DvcsBranchPopup.java    From consulo with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: BrowserLauncherImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #8
Source File: ChangeTemplateDataLanguageAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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);
      }
    }
  });
}
 
Example #9
Source File: SetTodoFilterAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #10
Source File: GotoActionAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
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)));
  }
}
 
Example #11
Source File: KeyboardInternationalizationNotificationManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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();
  }
}
 
Example #12
Source File: TableInfoServiceImpl.java    From EasyCode with MIT License 6 votes vote down vote up
/**
 * 类型校验,如果存在未知类型则引导用于去条件类型
 *
 * @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;
}
 
Example #13
Source File: UploadNotification.java    From markdown-image-kit with MIT License 6 votes vote down vote up
/**
 * 上传失败通知, 可打开设置面板
 * 文件链接, 帮助链接, 设置链接
 * 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);
}
 
Example #14
Source File: AbstractAction.java    From leetcode-editor with Apache License 2.0 6 votes vote down vote up
@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);
        }
    });

}
 
Example #15
Source File: IOExceptionDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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());
      }
    }
  };
}
 
Example #16
Source File: BrowserSelector.java    From consulo with Apache License 2.0 5 votes vote down vote up
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");
  }));
}
 
Example #17
Source File: DesktopShowSettingsUtilImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void showProjectStructureDialog(@Nonnull Project project, @Nonnull Consumer<ProjectStructureSelector> consumer) {
  new Task.Backgroundable(project, "Opening Project Structure...") {
    private ProjectStructureConfigurable myConfigurable;

    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      myConfigurable = ProjectStructureConfigurable.getInstance(project);
    }

    @RequiredUIAccess
    @Override
    public void onFinished() {
      UIAccess uiAccess = UIAccess.current();
      uiAccess.give(() -> {
        DesktopProjectStructureDialog dialog = new DesktopProjectStructureDialog(project, myConfigurable, ShowSettingsUtil.DIMENSION_KEY, myConfigurable);
        new UiNotifyConnector.Once(dialog.getContentPane(), new Activatable() {
          @Override
          public void showNotify() {
            consumer.accept(myConfigurable);
          }
        });
        dialog.showAsync();
      });
    }
  }.queue();
}
 
Example #18
Source File: ChangelistConflictDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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));
    }
  }};
}
 
Example #19
Source File: ChangelistConflictNotificationPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
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));
    }
  }));
}
 
Example #20
Source File: LombokProjectValidatorActivity.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void hyperlinkActivated(@NotNull final Notification notification, @NotNull final HyperlinkEvent e) {

  if (!project.isDisposed()) {
    ShowSettingsUtil.getInstance().showSettingsDialog(project, nameToSelect);
  }
}
 
Example #21
Source File: ModuleExtensionWithSdkOrderEntryTypeEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void navigate(@Nonnull final ModuleExtensionWithSdkOrderEntryImpl orderEntry) {
  final Sdk sdk = orderEntry.getSdk();
  if (sdk == null) {
    return;
  }
  Project project = orderEntry.getModuleRootLayer().getProject();
  ShowSettingsUtil.getInstance().showProjectStructureDialog(project, config -> config.select(sdk, true));
}
 
Example #22
Source File: SdkListConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public SdkListConfigurable(final Project project, ShowSettingsUtil showSettingsUtil) {
  super(project);

  ShowSdksSettingsUtil sdksSettingsUtil = (ShowSdksSettingsUtil)showSettingsUtil;

  mySdksModel = sdksSettingsUtil.getSdksModel();
  mySdksModel.addListener(myListener);
}
 
Example #23
Source File: BundleBoxBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static SdkModel effectiveModel(@Nullable SdkModel sdkModel) {
  if (sdkModel == null) {
    ShowSdksSettingsUtil sdksSettingsUtil = (ShowSdksSettingsUtil)ShowSettingsUtil.getInstance();

    return sdksSettingsUtil.getSdksModel();
  }
  else {
    return sdkModel;
  }
}
 
Example #24
Source File: ConfigureInspectionsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) {
    return;
  }

  Configurable provider = ConfigurableExtensionPointUtil.createProjectConfigurableForProvider(project, ErrorsConfigurableProvider.class);
  if (provider == null) {
    return;
  }
  ShowSettingsUtil.getInstance().editConfigurable(project, provider);
}
 
Example #25
Source File: EditCleanupProfileIntentionAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void invoke(@Nonnull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
  final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
  final ProjectInspectionToolsConfigurable configurable =
          new ProjectInspectionToolsConfigurable(InspectionProfileManager.getInstance(), profileManager) {
            @Override
            protected boolean acceptTool(InspectionToolWrapper entry) {
              return super.acceptTool(entry) && entry.isCleanupTool();
            }
          };
  ShowSettingsUtil.getInstance().editConfigurable(CodeCleanupAction.CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME,  project, configurable);
}
 
Example #26
Source File: ProjectStructureConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void reset() {
  // need this to ensure VFS operations will not block because of storage flushing
  // and other maintenance IO tasks run in background
  AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Resetting Project Structure");

  try {
    myContext.reset();

    ShowSdksSettingsUtil settingsUtil = (ShowSdksSettingsUtil)ShowSettingsUtil.getInstance();

    settingsUtil.getSdksModel().reset();

    Configurable toSelect = null;
    for (Configurable each : myName2Config) {
      if (myUiState.lastEditedConfigurable != null && myUiState.lastEditedConfigurable.equals(each.getDisplayName())) {
        toSelect = each;
      }
      if (each instanceof MasterDetailsComponent) {
        ((MasterDetailsComponent)each).setHistory(myHistory);
      }
      each.reset();
    }

    myHistory.clear();

    if (toSelect == null && myName2Config.size() > 0) {
      toSelect = myName2Config.iterator().next();
    }

    removeSelected();

    navigateTo(toSelect != null ? createPlaceFor(toSelect) : null, false);

  }
  finally {
    token.finish();
  }
}
 
Example #27
Source File: SdkListConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public SdkListConfigurable(final Project project, ShowSettingsUtil showSettingsUtil) {
  super(project);

  ShowSdksSettingsUtil sdksSettingsUtil = (ShowSdksSettingsUtil)showSettingsUtil;

  mySdksModel = sdksSettingsUtil.getSdksModel();
  mySdksModel.addListener(myListener);
}
 
Example #28
Source File: ShowStructureSettingsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(AnActionEvent e) {
  Project project = e.getDataContext().getData(CommonDataKeys.PROJECT);
  if (project == null) {
    project = ProjectManager.getInstance().getDefaultProject();
  }

  ShowSettingsUtil.getInstance().showProjectStructureDialog(project);
}
 
Example #29
Source File: AllFileTemplatesConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void editCodeTemplate(@Nonnull final String templateId, Project project) {
  final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
  final AllFileTemplatesConfigurable configurable = new AllFileTemplatesConfigurable(project);
  util.editConfigurable(project, configurable, () -> {
    configurable.myTabbedPane.setSelectedIndex(ArrayUtil.indexOf(configurable.myTabs, configurable.myCodeTemplatesList));
    for (FileTemplate template : configurable.myCodeTemplatesList.getTemplates()) {
      if (Comparing.equal(templateId, template.getName())) {
        configurable.myCodeTemplatesList.selectTemplate(template);
        break;
      }
    }
  });
}
 
Example #30
Source File: EditScopesAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = dataContext.getData(CommonDataKeys.PROJECT);
  LOG.assertTrue(project != null);
  final String scopeName = ProjectView.getInstance(project).getCurrentProjectViewPane().getSubId();
  LOG.assertTrue(scopeName != null);
  final ScopeChooserConfigurable scopeChooserConfigurable = new ScopeChooserConfigurable(project);
  ShowSettingsUtil.getInstance().editConfigurable(project, scopeChooserConfigurable, new Runnable(){
    @Override
    public void run() {
      scopeChooserConfigurable.selectNodeInTree(scopeName);
    }
  });
}