From 1469637c54dc8ac8173dfe7b388bca8ce507732e Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 13 Jun 2019 16:46:11 +0300 Subject: [PATCH] remove usages of deprecated ColorKey.getFallbackColorKey GitOrigin-RevId: 18831b8b5507dc601db12e968b6ff4818d8ef158 --- .../colors/impl/AbstractColorsScheme.java | 23 ++--------- .../colors/impl/DefaultColorsScheme.java | 8 +--- .../colors/impl/EditorColorsSchemeImpl.java | 8 ---- .../options/colors/ColorAndFontOptions.java | 38 +------------------ 4 files changed, 6 insertions(+), 71 deletions(-) diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java index bf324c33dcf2..381a068a72fa 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java @@ -725,15 +725,6 @@ public abstract class AbstractColorsScheme extends EditorFontCacheImpl implement private void writeColor(@NotNull Element colorElements, @NotNull ColorKey key) { Color color = myColorsMap.get(key); if (color == INHERITED_COLOR_MARKER) { - ColorKey fallbackKey = key.getFallbackColorKey(); - Color parentFallback = myParentScheme instanceof AbstractColorsScheme ? - ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedColor(key) : null; - boolean parentOverwritingInheritance = parentFallback != null && parentFallback != INHERITED_COLOR_MARKER; - if (fallbackKey != null && parentOverwritingInheritance) { - colorElements.addContent(new Element(OPTION_ELEMENT) - .setAttribute(NAME_ATTR, key.getExternalName()) - .setAttribute(BASE_ATTRIBUTES_ATTR, fallbackKey.getExternalName())); - } return; } @@ -860,17 +851,9 @@ public abstract class AbstractColorsScheme extends EditorFontCacheImpl implement @Nullable protected Color getFallbackColor(@NotNull ColorKey fallbackKey) { - ColorKey cur = fallbackKey; - while (true) { - Color color = getDirectlyDefinedColor(cur); - if (color == NULL_COLOR_MARKER) return null; - ColorKey next = cur.getFallbackColorKey(); - if (color != null && (color != INHERITED_COLOR_MARKER || next == null)) { - return color; - } - if (next == null) return null; - cur = next; - } + Color color = getDirectlyDefinedColor(fallbackKey); + if (color == NULL_COLOR_MARKER) return null; + return color; } /** diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java index b3138b35751f..434c0b48bd8c 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java @@ -70,14 +70,8 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl Color color = myColorsMap.get(key); if (color != null) return color == NULL_COLOR_MARKER ? null : color; - ColorKey fallbackKey = key.getFallbackColorKey(); - Color fallback = fallbackKey == null ? null : getFallbackColor(fallbackKey); - if (fallback != null && fallback != AbstractColorsScheme.INHERITED_COLOR_MARKER) return fallback; - if (!useDefaults) return null; - Color keyDefaults = key.getDefaultColor(); - if (keyDefaults != null) return keyDefaults; - return fallbackKey == null ? null : fallbackKey.getDefaultColor(); + return key.getDefaultColor(); } @Override diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java index eddade551436..d96d7ee95962 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java @@ -97,14 +97,6 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte if (color != null && color != INHERITED_COLOR_MARKER) { return color; } - - ColorKey fallbackKey = key.getFallbackColorKey(); - if (fallbackKey != null) { - color = getFallbackColor(fallbackKey); - if (color != null) { - return color; - } - } } return myParentScheme.getColor(key); } diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java index 39e0b7e1266b..bf90086266ea 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java @@ -35,7 +35,6 @@ import com.intellij.psi.search.scope.packageSet.NamedScope; import com.intellij.psi.search.scope.packageSet.NamedScopesHolder; import com.intellij.psi.search.scope.packageSet.PackageSet; import com.intellij.util.EventDispatcher; -import com.intellij.util.ObjectUtils; import com.intellij.util.ui.UIUtil; import gnu.trove.THashMap; import gnu.trove.THashSet; @@ -817,26 +816,11 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract super(name, group, colorKey.getExternalName(), scheme, null, null); myColorKey = colorKey; myKind = kind; - ColorKey fallbackKey = myColorKey.getFallbackColorKey(); - Color fallbackColor = null; - if (fallbackKey != null) { - fallbackColor = scheme.getColor(fallbackKey); - myBaseAttributeDescriptor = ColorSettingsPages.getInstance().getColorDescriptor(fallbackKey); - if (myBaseAttributeDescriptor == null) { - myBaseAttributeDescriptor = Pair.create(null, new ColorDescriptor(fallbackKey.getExternalName(), fallbackKey, myKind)); - } - myFallbackAttributes = new TextAttributes(myKind == ColorDescriptor.Kind.FOREGROUND ? fallbackColor : null, - myKind == ColorDescriptor.Kind.BACKGROUND ? fallbackColor : null, - null, null, Font.PLAIN); - } myColor = scheme.getColor(myColorKey); - myInitialColor = ObjectUtils.chooseNotNull(fallbackColor, myColor); + myInitialColor = myColor; - myIsInheritedInitial = scheme.isInherited(myColorKey); + myIsInheritedInitial = false; setInherited(myIsInheritedInitial); - if (myIsInheritedInitial) { - //setInheritedAttributes(getTextAttributes()); - } initCheckedStatus(); } @@ -1121,24 +1105,6 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract return false; } - public boolean isInherited(ColorKey key) { - ColorKey fallbackKey = key.getFallbackColorKey(); - if (fallbackKey != null) { - if (myParentScheme instanceof AbstractColorsScheme) { - Color ownAttrs = ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedColor(key); - if (ownAttrs != null) { - return ownAttrs == AbstractColorsScheme.INHERITED_COLOR_MARKER; - } - } - Color attributes = getColor(key); - if (attributes != null) { - Color fallback = getColor(fallbackKey); - return attributes == fallback; - } - } - return false; - } - public void resetToOriginal() { if (myParentScheme instanceof AbstractColorsScheme) { AbstractColorsScheme originalScheme = ((AbstractColorsScheme)myParentScheme).getOriginal();