From 1d3d3b28a293a0ef1554aa1f05ea2723ec7aabe1 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Tue, 15 Jan 2013 20:40:01 +0400 Subject: [PATCH] Let default attributes have a bigger priority if defined --- .../intellij/openapi/editor/colors/TextAttributesKey.java | 8 ++++---- .../openapi/editor/colors/impl/DefaultColorsScheme.java | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) 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 fffa291b9ed7..dbd1d96c1317 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 @@ -109,11 +109,11 @@ public final class TextAttributesKey implements Comparable, J * @return the text attributes. */ public TextAttributes getDefaultAttributes() { - if (myFallbackAttributeKey != null) { - TextAttributes fallbackAttributes = myFallbackAttributeKey.getDefaultAttributes(); - if (fallbackAttributes != null && !fallbackAttributes.isEmpty()) return fallbackAttributes; - } if (myDefaultAttributes == NULL_ATTRIBUTES) { + if (myFallbackAttributeKey != null) { + TextAttributes fallbackAttributes = myFallbackAttributeKey.getDefaultAttributes(); + if (fallbackAttributes != null && !fallbackAttributes.isEmpty()) return fallbackAttributes; + } // E.g. if one text key reuse default attributes of some other predefined key myDefaultAttributes = null; final TextAttributeKeyDefaultsProvider provider = ourDefaultsProvider.getValue(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java index e2f8d3bb30f7..7f996360d6eb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java @@ -43,10 +43,7 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl if (key == null) return null; TextAttributes attrs = myAttributesMap.get(key); if (attrs == null) { - attrs = getFallbackAttributes(key.getFallbackAttributeKey()); - if (attrs == null) { attrs = key.getDefaultAttributes(); - } } return attrs; }