Java Code Examples for com.intellij.openapi.options.ShowSettingsUtil#editConfigurable()

The following examples show how to use com.intellij.openapi.options.ShowSettingsUtil#editConfigurable() . 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: 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 2
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;
      }
    }
  });
}