Example usage for com.intellij.openapi.options.colors ColorSettingsPage getDisplayName

List of usage examples for com.intellij.openapi.options.colors ColorSettingsPage getDisplayName

Introduction

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

Prototype

@NotNull
String getDisplayName();

Source Link

Document

Returns the title of the page, shown as text in the dialog tab.

Usage

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

License:Apache License

private void setInheritanceInfo(ColorAndFontDescription description) {
    Pair<ColorSettingsPage, AttributesDescriptor> baseDescriptor = description.getBaseAttributeDescriptor();
    if (baseDescriptor != null && baseDescriptor.second.getDisplayName() != null) {
        String attrName = baseDescriptor.second.getDisplayName();
        ColorSettingsPage settingsPage = baseDescriptor.first;
        String pageName = "?";
        if (settingsPage != null) {
            pageName = settingsPage.getDisplayName();
        }/*w ww.j  a va  2 s  .  c o  m*/
        String tooltipText = attrName + " (" + pageName + ")";
        String labelText = tooltipText;
        if (labelText.length() > 30 && pageName.length() >= 4) {
            labelText = attrName + " (" + pageName.substring(0, 4) + "...)";
        }
        myInheritanceLabel.setText(labelText);
        myInheritanceLabel.setToolTipText(tooltipText);
        myInheritanceLabel.setForeground(myLabelFont.getForeground());
        myInheritanceLabel.setEnabled(description.isInherited());
        myInheritAttributesBox.setEnabled(true);
        myInheritAttributesBox.setSelected(description.isInherited());
        setEditEnabled(!description.isInherited(), description);
    } else {
        myInheritanceLabel.setText("X");
        myInheritanceLabel.setIcon(null);
        myInheritanceLabel.setDisabledIcon(null);
        myInheritanceLabel.setEnabled(true);
        myInheritanceLabel.setForeground(myLabelFont.getBackground());
        myInheritAttributesBox.setEnabled(false);
        myInheritAttributesBox.setSelected(false);
        setEditEnabled(true, description);
    }
}

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 w  w w  .  j av  a  2s  .  c om
            @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;
}