mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Uncheck color selection boxes if colors are equal to base (fallback) attributes, reset the attributes to restore color inheritance.
This commit is contained in:
@@ -162,6 +162,13 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
return getForegroundColor() == null && getBackgroundColor() == null && getEffectColor() == null && getFontType() == Font.PLAIN;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
setForegroundColor(null);
|
||||
setBackgroundColor(null);
|
||||
setEffectColor(null);
|
||||
setFontType(Font.PLAIN);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AttributesFlyweight getFlyweight() {
|
||||
return myAttrs;
|
||||
|
||||
+35
-1
@@ -790,10 +790,44 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
return attributes;
|
||||
}
|
||||
|
||||
private boolean equalToFallbackAttributes() {
|
||||
if (myFallbackAttributes != null) {
|
||||
return myFallbackAttributes.equals(getTextAttributes());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBackgroundChecked() {
|
||||
if (equalToFallbackAttributes()) return false;
|
||||
return super.isBackgroundChecked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForegroundChecked() {
|
||||
if (equalToFallbackAttributes()) return false;
|
||||
return super.isForegroundChecked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isErrorStripeChecked() {
|
||||
if (equalToFallbackAttributes()) return false;
|
||||
return super.isErrorStripeChecked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEffectsColorChecked() {
|
||||
if (equalToFallbackAttributes()) return false;
|
||||
return super.isEffectsColorChecked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(EditorColorsScheme scheme) {
|
||||
if (scheme == null) scheme = getScheme();
|
||||
if (myAttributesToApply != null && !getTextAttributes().equals(myFallbackAttributes)) {
|
||||
if (myAttributesToApply != null) {
|
||||
if (equalToFallbackAttributes()) {
|
||||
getTextAttributes().reset();
|
||||
}
|
||||
scheme.setAttributes(key, getTextAttributes());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user