Merge remote-tracking branch 'origin/master'

This commit is contained in:
anna
2013-01-15 12:50:17 +01:00
4 changed files with 27 additions and 15 deletions
@@ -140,10 +140,13 @@ public class HighlightInfo implements Segment {
return null;
}
if (forcedTextAttributesKey != null) {
final Color errorStripeColor = scheme.getAttributes(forcedTextAttributesKey).getErrorStripeColor();
// let's copy above behaviour of forcedTextAttributes stripe color, but I'm not sure that the behaviour is correct in general
if (errorStripeColor != null) {
return errorStripeColor;
TextAttributes forcedTextAttributes = scheme.getAttributes(forcedTextAttributesKey);
if (forcedTextAttributes != null) {
final Color errorStripeColor = forcedTextAttributes.getErrorStripeColor();
// let's copy above behaviour of forcedTextAttributes stripe color, but I'm not sure that the behaviour is correct in general
if (errorStripeColor != null) {
return errorStripeColor;
}
}
}
@@ -558,4 +558,15 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
return "Monospaced";
}
protected TextAttributes getFallbackAttributes(TextAttributesKey fallbackKey) {
if (fallbackKey == null) return null;
if (myAttributesMap.containsKey(fallbackKey)) {
TextAttributes fallbackAttributes = myAttributesMap.get(fallbackKey);
if (fallbackAttributes != null && (!fallbackAttributes.isEmpty() || fallbackKey.getFallbackAttributeKey() == null)) {
return fallbackAttributes;
}
}
return getFallbackAttributes(fallbackKey.getFallbackAttributeKey());
}
}
@@ -26,6 +26,7 @@ import com.intellij.openapi.editor.colors.ex.DefaultColorSchemesManager;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.InvalidDataException;
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
@@ -37,10 +38,17 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
}
@Override
@Nullable
public TextAttributes getAttributes(TextAttributesKey key) {
if (key == null) return null;
TextAttributes attrs = myAttributesMap.get(key);
return attrs != null ? attrs : key.getDefaultAttributes();
if (attrs == null) {
attrs = getFallbackAttributes(key.getFallbackAttributeKey());
if (attrs == null) {
attrs = key.getDefaultAttributes();
}
}
return attrs;
}
@Override
@@ -68,16 +68,6 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte
return myParentScheme.getAttributes(key);
}
private TextAttributes getFallbackAttributes(TextAttributesKey fallbackKey) {
if (fallbackKey == null) return null;
if (myAttributesMap.containsKey(fallbackKey)) {
TextAttributes fallbackAttributes = myAttributesMap.get(fallbackKey);
if (fallbackAttributes != null && (!fallbackAttributes.isEmpty() || fallbackKey.getFallbackAttributeKey() == null)) {
return fallbackAttributes;
}
}
return getFallbackAttributes(fallbackKey.getFallbackAttributeKey());
}
public boolean containsKey(TextAttributesKey key) {
return myAttributesMap.containsKey(key);