Search in sources :

Example 1 with SimpleEditorPreview

use of com.intellij.application.options.colors.SimpleEditorPreview 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);
}
Also used : ColorAndFontOptions(com.intellij.application.options.colors.ColorAndFontOptions) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) ColorSettingsPage(com.intellij.openapi.options.colors.ColorSettingsPage) SimpleEditorPreview(com.intellij.application.options.colors.SimpleEditorPreview) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ColorAndFontOptions (com.intellij.application.options.colors.ColorAndFontOptions)1 SimpleEditorPreview (com.intellij.application.options.colors.SimpleEditorPreview)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 ColorSettingsPage (com.intellij.openapi.options.colors.ColorSettingsPage)1 NotNull (org.jetbrains.annotations.NotNull)1