@Nullable public NewColorAndFontPanel findPage(String pageName) { if (mySubPanelFactories == null) { buildConfigurables(); } for (InnerSearchableConfigurable configurable : mySubPanelFactories.values()) { if (configurable.getDisplayName().equals(pageName)) { return configurable.createPanel(); } } return null; }
@Nullable public InnerSearchableConfigurable findSubConfigurable(@NotNull final Class pageClass) { if (mySubPanelFactories == null) { buildConfigurables(); } for (Map.Entry<ColorAndFontPanelFactory, InnerSearchableConfigurable> entry : mySubPanelFactories.entrySet()) { if (pageClass.isInstance(entry.getValue().createPanel().getSettingsPage())) { return entry.getValue(); } } return null; }
private void editColorsAndFonts() { final String toConfigure = getSelectedType().getSeverity(null).myName; doOKAction(); myOptionsList.clearSelection(); final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel); final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext); if (optionsEditor != null) { final ColorAndFontOptions colorAndFontOptions = optionsEditor.findConfigurable(ColorAndFontOptions.class); assert colorAndFontOptions != null; final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class); LOG.assertTrue(javaPage != null); optionsEditor .clearSearchAndSelect(javaPage) .doWhenDone( new Runnable() { @Override public void run() { final Runnable runnable = javaPage.enableSearch(toConfigure); if (runnable != null) { SwingUtilities.invokeLater(runnable); } } }); } else { ColorAndFontOptions colorAndFontOptions = new ColorAndFontOptions(); final Configurable[] configurables = colorAndFontOptions.buildConfigurables(); try { final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class); LOG.assertTrue(javaPage != null); ShowSettingsUtil.getInstance() .editConfigurable(CommonDataKeys.PROJECT.getData(dataContext), javaPage); } finally { for (Configurable configurable : configurables) { configurable.disposeUIResources(); } colorAndFontOptions.disposeUIResources(); } } }