diff --git a/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java b/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java index dbd1d96c1317..f68ad6221428 100644 --- a/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java +++ b/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java @@ -166,34 +166,6 @@ public final class TextAttributesKey implements Comparable, J return key; } - /** - * Similar to createTextAttributesKey(externalName, fallbackAttributeKey) but allows to specify attributes which will be used - * in default scheme as well as in a scheme created as a copy of default scheme. If specified, shadows a fallback attribute: a scheme - * designer may need to clear the attributes to restore dependency on the fallback key. It is strongly recommended to use this method - * only if absolutely necessary to define specific highlighting attributes which can not be referenced by any of the keys in - * DefaultLanguageHighlighterColors. - *

- * If a scheme doesn't have the specified key if, for example, it was designed without an installed language plug-in, a fallback key - * will be used instead of default text attributes specified here. - *

- * - * @param externalName The unique identifier of the key. - * @param fallbackAttributeKey The fallback key to use if text attributes for this key are not defined. - * @param defaultAttributes The default text attributes associated with the key. - * @return - */ - @NotNull - public static TextAttributesKey createTextAttributesKey(@NonNls @NotNull String externalName, - TextAttributesKey fallbackAttributeKey, - TextAttributes defaultAttributes) { - TextAttributesKey key = find(externalName); - key.setFallbackAttributeKey(fallbackAttributeKey); - if (key.myDefaultAttributes == null || key.myDefaultAttributes == NULL_ATTRIBUTES) { - key.myDefaultAttributes = defaultAttributes; - } - return key; - } - public TextAttributesKey getFallbackAttributeKey() { return myFallbackAttributeKey; } diff --git a/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java b/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java index ac4cdef78851..96f830c78221 100644 --- a/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java +++ b/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java @@ -16,48 +16,48 @@ package com.intellij.openapi.editor; import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.editor.markup.TextAttributes; /** * Base highlighter colors for multiple languages. * * @author Rustam Vishnyakov */ -@SuppressWarnings("deprecation") // SyntaxHighlighterColors is used for compatibility with old schemes public class DefaultLanguageHighlighterColors { public final static TextAttributesKey TEMPLATE_LANGUAGE_COLOR = - TextAttributesKey.createTextAttributesKey("DEFAULT_TEMPLATE_LANGUAGE_COLOR"); + TextAttributesKey.createTextAttributesKey("DEFAULT_TEMPLATE_LANGUAGE_COLOR", HighlighterColors.TEXT); public final static TextAttributesKey IDENTIFIER = - TextAttributesKey.createTextAttributesKey("DEFAULT_IDENTIFIER", HighlighterColors.TEXT); + TextAttributesKey.createTextAttributesKey("DEFAULT_IDENTIFIER"); public final static TextAttributesKey NUMBER = - TextAttributesKey.createTextAttributesKey("DEFAULT_NUMBER", SyntaxHighlighterColors.NUMBER.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_NUMBER"); public final static TextAttributesKey KEYWORD = - TextAttributesKey.createTextAttributesKey("DEFAULT_KEYWORD", SyntaxHighlighterColors.KEYWORD.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_KEYWORD"); public final static TextAttributesKey STRING = - TextAttributesKey.createTextAttributesKey("DEFAULT_STRING", SyntaxHighlighterColors.STRING.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_STRING", HighlighterColors.TEXT); public final static TextAttributesKey BLOCk_COMMENT = - TextAttributesKey.createTextAttributesKey("DEFAULT_BLOCK_COMMENT", SyntaxHighlighterColors.JAVA_BLOCK_COMMENT.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_BLOCK_COMMENT"); public final static TextAttributesKey LINE_COMMENT = - TextAttributesKey.createTextAttributesKey("DEFAULT_LINE_COMMENT", SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_LINE_COMMENT"); public final static TextAttributesKey DOC_COMMENT = - TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT", SyntaxHighlighterColors.DOC_COMMENT.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT"); public final static TextAttributesKey OPERATION_SIGN = - TextAttributesKey.createTextAttributesKey("DEFAULT_OPERATION_SIGN", SyntaxHighlighterColors.OPERATION_SIGN.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_OPERATION_SIGN"); public final static TextAttributesKey BRACES = - TextAttributesKey.createTextAttributesKey("DEFAULT_BRACES", SyntaxHighlighterColors.BRACES.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_BRACES"); public final static TextAttributesKey DOT = - TextAttributesKey.createTextAttributesKey("DEFAULT_DOT", SyntaxHighlighterColors.DOT.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_DOT"); public final static TextAttributesKey SEMICOLON = - TextAttributesKey.createTextAttributesKey("DEFAULT_SEMICOLON", SyntaxHighlighterColors.JAVA_SEMICOLON.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_SEMICOLON"); public final static TextAttributesKey COMMA = - TextAttributesKey.createTextAttributesKey("DEFAULT_COMMA", SyntaxHighlighterColors.COMMA.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_COMMA"); public final static TextAttributesKey PARENTHESES = - TextAttributesKey.createTextAttributesKey("DEFAULT_PARENTHS", SyntaxHighlighterColors.PARENTHS.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_PARENTHS"); public final static TextAttributesKey BRACKETS = - TextAttributesKey.createTextAttributesKey("DEFAULT_BRACKETS", SyntaxHighlighterColors.BRACKETS.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_BRACKETS"); public final static TextAttributesKey LABEL = - TextAttributesKey.createTextAttributesKey("DEFAULT_LABEL"); + TextAttributesKey.createTextAttributesKey("DEFAULT_LABEL", IDENTIFIER); public final static TextAttributesKey CONSTANT = TextAttributesKey.createTextAttributesKey("DEFAULT_CONSTANT", IDENTIFIER); public final static TextAttributesKey LOCAL_VARIABLE = @@ -87,15 +87,15 @@ public class DefaultLanguageHighlighterColors { TextAttributesKey.createTextAttributesKey("DEFAULT_STATIC_FIELD", IDENTIFIER); public final static TextAttributesKey DOC_COMMENT_MARKUP = - TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_MARKUP", SyntaxHighlighterColors.DOC_COMMENT_MARKUP.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_MARKUP"); public final static TextAttributesKey DOC_COMMENT_TAG = - TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG", SyntaxHighlighterColors.DOC_COMMENT_TAG.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG"); + public final static TextAttributesKey DOC_COMMENT_TAG_VALUE = + TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG_VALUE"); public final static TextAttributesKey VALID_STRING_ESCAPE = - TextAttributesKey - .createTextAttributesKey("DEFAULT_VALID_STRING_ESCAPE", SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_VALID_STRING_ESCAPE"); public final static TextAttributesKey INVALID_STRING_ESCAPE = - TextAttributesKey - .createTextAttributesKey("DEFAULT_INVALID_STRING_ESCAPE", SyntaxHighlighterColors.INVALID_STRING_ESCAPE.getDefaultAttributes()); + TextAttributesKey.createTextAttributesKey("DEFAULT_INVALID_STRING_ESCAPE"); public final static TextAttributesKey PREDEFINED_SYMBOL = TextAttributesKey.createTextAttributesKey("DEFAULT_PREDEFINED_SYMBOL", IDENTIFIER); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java index 261f072e13d9..9e4da4acba34 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java @@ -445,10 +445,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme { if (key.getFallbackAttributeKey() != null && value.isEmpty()) return false; boolean hasDefaultValue = value.equals(defaultAttribute); if (myParentScheme == null) return !hasDefaultValue; - if (EditorColorsManager.getInstance().getGlobalScheme() == this - && myParentScheme instanceof AbstractColorsScheme - && !((AbstractColorsScheme)myParentScheme).myAttributesMap.containsKey(key)) return !value.isEmpty(); - return !value.equals(myParentScheme.getAttributes(key)); + return true; } private void writeAttributes(Element attrElements) throws WriteExternalException { diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java index 9d9c86981004..4d5e65d279a6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java @@ -53,7 +53,7 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte @Override public TextAttributes getAttributes(TextAttributesKey key) { - if (key != null) { + if (key != null) { TextAttributesKey fallbackKey = key.getFallbackAttributeKey(); TextAttributes attributes = myAttributesMap.get(key); if (fallbackKey == null) { @@ -63,6 +63,9 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte if (attributes != null && !attributes.isEmpty()) return attributes; attributes = getFallbackAttributes(fallbackKey); if (attributes != null) return attributes; + if (myParentScheme instanceof DefaultColorsScheme && !DEFAULT_SCHEME_NAME.equals(getName())) { + return null; + } } } return myParentScheme.getAttributes(key); diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml index a40dcc80f0ab..74713cdd0eb8 100644 --- a/platform/platform-resources/src/DefaultColorSchemesManager.xml +++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml @@ -90,6 +90,71 @@ + + + + + + + + + + +