Example usage for com.intellij.openapi.options.colors ColorSettingsPages getInstance

List of usage examples for com.intellij.openapi.options.colors ColorSettingsPages getInstance

Introduction

In this page you can find the example usage for com.intellij.openapi.options.colors ColorSettingsPages getInstance.

Prototype

public static ColorSettingsPages getInstance() 

Source Link

Document

Gets the global instance of the registry.

Usage

From source file:com.intellij.application.options.colors.ColorAndFontOptions.java

License:Apache License

protected List<ColorAndFontPanelFactory> createPanelFactories() {
    List<ColorAndFontPanelFactory> result = new ArrayList<ColorAndFontPanelFactory>();
    result.add(new FontConfigurableFactory());

    List<ColorAndFontPanelFactory> extensions = new ArrayList<ColorAndFontPanelFactory>();
    extensions.add(new ConsoleFontConfigurableFactory());
    ColorSettingsPage[] pages = ColorSettingsPages.getInstance().getRegisteredPages();
    for (final ColorSettingsPage page : pages) {
        extensions.add(new ColorAndFontPanelFactoryEx() {
            @Override/*from  ww  w  .ja  va2s .co  m*/
            @NotNull
            public NewColorAndFontPanel createPanel(@NotNull ColorAndFontOptions options) {
                final SimpleEditorPreview preview = new SimpleEditorPreview(options, page);
                return NewColorAndFontPanel.create(preview, page.getDisplayName(), options, null, page);
            }

            @Override
            @NotNull
            public String getPanelDisplayName() {
                return page.getDisplayName();
            }

            @Override
            public DisplayPriority getPriority() {
                if (page instanceof DisplayPrioritySortable) {
                    return ((DisplayPrioritySortable) page).getPriority();
                }
                return DisplayPriority.LANGUAGE_SETTINGS;
            }
        });
    }
    Collections.addAll(extensions, Extensions.getExtensions(ColorAndFontPanelFactory.EP_NAME));
    Collections.sort(extensions, new Comparator<ColorAndFontPanelFactory>() {
        @Override
        public int compare(ColorAndFontPanelFactory f1, ColorAndFontPanelFactory f2) {
            if (f1 instanceof DisplayPrioritySortable) {
                if (f2 instanceof DisplayPrioritySortable) {
                    int result = ((DisplayPrioritySortable) f1).getPriority()
                            .compareTo(((DisplayPrioritySortable) f2).getPriority());
                    if (result != 0)
                        return result;
                } else {
                    return 1;
                }
            } else if (f2 instanceof DisplayPrioritySortable) {
                return -1;
            }
            return f1.getPanelDisplayName().compareToIgnoreCase(f2.getPanelDisplayName());
        }
    });
    result.addAll(extensions);

    result.add(new DiffColorsPageFactory());
    result.add(new FileStatusColorsPageFactory());
    result.add(new ScopeColorsPageFactory());

    return result;
}

From source file:com.intellij.application.options.colors.ColorAndFontOptions.java

License:Apache License

private static void initPluggedDescriptions(@NotNull List<EditorSchemeAttributeDescriptor> descriptions,
        @NotNull MyColorScheme scheme) {
    ColorSettingsPage[] pages = ColorSettingsPages.getInstance().getRegisteredPages();
    for (ColorSettingsPage page : pages) {
        initDescriptions(page, descriptions, scheme);
    }/*from   ww w .ja  v a2  s.c  om*/
    for (ColorAndFontDescriptorsProvider provider : Extensions
            .getExtensions(ColorAndFontDescriptorsProvider.EP_NAME)) {
        initDescriptions(provider, descriptions, scheme);
    }
}

From source file:org.codehaus.groovy.intellij.GroovySupportLoader.java

License:Apache License

public void initComponent() {
    System.setProperty("groovy.jsr", "true");

    ApplicationManager.getApplication().runWriteAction(new Runnable() {
        public void run() {
            FileTypeManager.getInstance().registerFileType(GROOVY,
                    new String[] { "groovy", "gvy", "gy", "gsh" });
            groovyLibraryManager.installOrUpgradeGroovyRuntimeAsAGlobalLibraryIfNecessary();
        }/*from w w  w.j  a  va2s .  co m*/
    });

    ColorSettingsPages.getInstance().registerPage(new GroovyColourSettingsPage());
}