use of com.intellij.application.options.colors.ColorAndFontOptions in project intellij-community by JetBrains.
the class SeverityEditorDialog method editColorsAndFonts.
private void editColorsAndFonts() {
final String toConfigure = getSelectedType().getSeverity(null).myName;
if (myCloseDialogWhenSettingsShown) {
doOKAction();
}
myOptionsList.clearSelection();
final DataContext dataContext = DataManager.getInstance().getDataContext(myPanel);
Settings settings = Settings.KEY.getData(dataContext);
if (settings != null) {
ColorAndFontOptions colorAndFontOptions = settings.find(ColorAndFontOptions.class);
assert colorAndFontOptions != null;
final SearchableConfigurable javaPage = colorAndFontOptions.findSubConfigurable(InspectionColorSettingsPage.class);
LOG.assertTrue(javaPage != null);
settings.select(javaPage).doWhenDone(() -> {
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();
}
}
}
use of com.intellij.application.options.colors.ColorAndFontOptions in project intellij-community by JetBrains.
the class SetBackgroundImageDialog method createEditorPreview.
@NotNull
private static SimpleEditorPreview createEditorPreview() {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
ColorAndFontOptions options = new ColorAndFontOptions();
options.reset();
options.selectScheme(scheme.getName());
ColorSettingsPage[] pages = ColorSettingsPages.getInstance().getRegisteredPages();
int index;
int attempt = 0;
do {
index = (int) Math.round(Math.random() * (pages.length - 1));
} while (StringUtil.countNewLines(pages[index].getDemoText()) < 8 && ++attempt < 10);
return new SimpleEditorPreview(options, pages[index], false);
}
Aggregations