Example usage for com.intellij.openapi.options.colors AttributesDescriptor getKey

List of usage examples for com.intellij.openapi.options.colors AttributesDescriptor getKey

Introduction

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

Prototype

@SuppressWarnings("RedundantMethodOverride") 
    @NotNull
    @Override
    public TextAttributesKey getKey() 

Source Link

Usage

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

License:Apache License

private static void initDescriptions(@NotNull ColorAndFontDescriptorsProvider provider,
        @NotNull List<EditorSchemeAttributeDescriptor> descriptions, @NotNull MyColorScheme scheme) {
    String group = provider.getDisplayName();
    List<AttributesDescriptor> attributeDescriptors = ColorSettingsUtil.getAllAttributeDescriptors(provider);
    for (AttributesDescriptor descriptor : attributeDescriptors) {
        addSchemedDescription(descriptions, descriptor.getDisplayName(), group, descriptor.getKey(), scheme,
                null, null);//from www.j  av a2 s. c  om
    }

    ColorDescriptor[] colorDescriptors = provider.getColorDescriptors();
    for (ColorDescriptor descriptor : colorDescriptors) {
        ColorKey back = descriptor.getKind() == ColorDescriptor.Kind.BACKGROUND ? descriptor.getKey() : null;
        ColorKey fore = descriptor.getKind() == ColorDescriptor.Kind.FOREGROUND ? descriptor.getKey() : null;
        addEditorSettingDescription(descriptions, descriptor.getDisplayName(), group, back, fore, scheme);
    }
}

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

License:Apache License

public static Map<TextAttributesKey, String> keyToDisplayTextMap(final ColorSettingsPage page) {
    final List<AttributesDescriptor> attributeDescriptors = getAllAttributeDescriptors(page);
    final Map<TextAttributesKey, String> displayText = new HashMap<TextAttributesKey, String>();
    for (AttributesDescriptor attributeDescriptor : attributeDescriptors) {
        final TextAttributesKey key = attributeDescriptor.getKey();
        displayText.put(key, attributeDescriptor.getDisplayName());
    }/*w  ww . j a va 2  s  . com*/
    return displayText;
}

From source file:org.codehaus.groovy.intellij.language.editor.GroovyColourSettingsPageTest.java

License:Apache License

public void testUsesAttributeDescriptorsDerivedFromTheOnesDefinedOnTheJavaColourSettingsPage() {
    AttributesDescriptor[] groovyAttributesDescriptors = groovyColourSettingsPage.getAttributeDescriptors();
    AttributesDescriptor[] javaAttributesDescriptors = javaColourSettingsPage.getAttributeDescriptors();

    assertTrue("should have a greater or equal number of attribute descriptors than the Java page",
            groovyAttributesDescriptors.length >= javaAttributesDescriptors.length);

    List<TextAttributes> groovyAttributeDescriptorAttributes = new ArrayList<TextAttributes>();
    for (AttributesDescriptor attributesDescriptor : groovyAttributesDescriptors) {
        groovyAttributeDescriptorAttributes.add(attributesDescriptor.getKey().getDefaultAttributes());
    }//ww  w .j a v a  2  s.c  om

    for (int i = 0; i < javaAttributesDescriptors.length; i++) {
        ListAssert.assertContains("attribute descriptor attributes #" + i, groovyAttributeDescriptorAttributes,
                javaAttributesDescriptors[i].getKey().getDefaultAttributes());
    }
}