mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
FIXED IDEA-152156 Unable to save new colors for old existing theme
This commit is contained in:
+10
-1
@@ -606,7 +606,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
|
||||
Element element = new Element(OPTION_ELEMENT);
|
||||
element.setAttribute(NAME_ATTR, key.getExternalName());
|
||||
if (baseKey != null && value.isFallbackEnabled()) {
|
||||
if (defaultFallbackAttr != null && defaultAttr != null && defaultAttr != defaultFallbackAttr) {
|
||||
if (isParentOverwritingInheritance(key)) {
|
||||
element.setAttribute(BASE_ATTRIBUTES_ATTR, baseKey.getExternalName());
|
||||
attrElements.addContent(element);
|
||||
}
|
||||
@@ -622,6 +622,15 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isParentOverwritingInheritance(@NotNull TextAttributesKey key) {
|
||||
TextAttributes parentAttrs =
|
||||
myParentScheme instanceof AbstractColorsScheme ? ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key) : null;
|
||||
if (parentAttrs != null) {
|
||||
return !parentAttrs.isFallbackEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Color getOwnColor(ColorKey key) {
|
||||
return myColorsMap.get(key);
|
||||
}
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ public class EditorColorsSchemeImplTest extends LightPlatformCodeInsightTestCase
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void _testIdea152156() throws Exception {
|
||||
public void testIdea152156() throws Exception {
|
||||
EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME);
|
||||
EditorColorsScheme parentScheme = (EditorColorsScheme)defaultScheme.clone();
|
||||
parentScheme.setName("DefaultTest");
|
||||
|
||||
Reference in New Issue
Block a user