Let default attributes have a bigger priority if defined

This commit is contained in:
Rustam Vishnyakov
2013-01-16 12:37:28 +04:00
parent 24b49c1a06
commit 1d3d3b28a2
2 changed files with 4 additions and 7 deletions
@@ -109,11 +109,11 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey>, 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();
@@ -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;
}