Search in sources :

Example 6 with AttributesDescriptor

use of com.intellij.openapi.options.colors.AttributesDescriptor in project intellij-community by JetBrains.

the class ColorAndFontDescriptionPanel method setInheritanceInfo.

private void setInheritanceInfo(ColorAndFontDescription description) {
    Pair<ColorSettingsPage, AttributesDescriptor> baseDescriptor = description.getBaseAttributeDescriptor();
    if (baseDescriptor != null && baseDescriptor.second.getDisplayName() != null) {
        String attrName = baseDescriptor.second.getDisplayName();
        String attrLabel = attrName.replaceAll(EditorSchemeAttributeDescriptorWithPath.NAME_SEPARATOR, FontUtil.rightArrow(UIUtil.getLabelFont()));
        ColorSettingsPage settingsPage = baseDescriptor.first;
        String style = "<div style=\"text-align:right\" vertical-align=\"top\">";
        String tooltipText;
        String labelText;
        if (settingsPage != null) {
            String pageName = settingsPage.getDisplayName();
            tooltipText = "'" + attrLabel + "' from<br>'" + pageName + "' section";
            labelText = style + "'" + attrLabel + "'<br>of <a href=\"" + attrName + "\">" + pageName;
        } else {
            tooltipText = attrLabel;
            labelText = style + attrLabel + "<br>&nbsp;";
        }
        myInheritanceLabel.setVisible(true);
        myInheritanceLabel.setText(labelText);
        myInheritanceLabel.setToolTipText(tooltipText);
        myInheritanceLabel.setEnabled(true);
        myInheritAttributesBox.setVisible(true);
        myInheritAttributesBox.setEnabled(description.isEditable());
        myInheritAttributesBox.setSelected(description.isInherited());
        setEditEnabled(!description.isInherited() && description.isEditable(), description);
    } else {
        myInheritanceLabel.setVisible(false);
        myInheritAttributesBox.setSelected(false);
        myInheritAttributesBox.setVisible(false);
        setEditEnabled(description.isEditable(), description);
    }
}
Also used : AttributesDescriptor(com.intellij.openapi.options.colors.AttributesDescriptor) ColorSettingsPage(com.intellij.openapi.options.colors.ColorSettingsPage)

Aggregations

AttributesDescriptor (com.intellij.openapi.options.colors.AttributesDescriptor)6 TextAttributesKey (com.intellij.openapi.editor.colors.TextAttributesKey)3 ColorSettingsPage (com.intellij.openapi.options.colors.ColorSettingsPage)3 HighlightInfo (com.intellij.codeInsight.daemon.impl.HighlightInfo)1 HighlightInfoType (com.intellij.codeInsight.daemon.impl.HighlightInfoType)1 SeveritiesProvider (com.intellij.codeInsight.daemon.impl.SeveritiesProvider)1 HintManager (com.intellij.codeInsight.hint.HintManager)1 ShowSettingsUtilImpl (com.intellij.ide.actions.ShowSettingsUtilImpl)1 EditorWindow (com.intellij.injected.editor.EditorWindow)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)1 Editor (com.intellij.openapi.editor.Editor)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 MarkupModelEx (com.intellij.openapi.editor.ex.MarkupModelEx)1 RangeHighlighterEx (com.intellij.openapi.editor.ex.RangeHighlighterEx)1 EditorUtil (com.intellij.openapi.editor.ex.util.EditorUtil)1 LexerEditorHighlighter (com.intellij.openapi.editor.ex.util.LexerEditorHighlighter)1 EditorHighlighter (com.intellij.openapi.editor.highlighter.EditorHighlighter)1 HighlighterIterator (com.intellij.openapi.editor.highlighter.HighlighterIterator)1