mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
A better name for enforced empty values: TextAttributes.setEnforceEmpty()
This commit is contained in:
@@ -33,8 +33,9 @@ public class TextAttributes implements Cloneable {
|
||||
|
||||
public static final TextAttributes ERASE_MARKER = new TextAttributes();
|
||||
|
||||
private boolean myEnforcedDefaults;
|
||||
private boolean myEnforceEmpty;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NotNull
|
||||
private AttributesFlyweight myAttrs;
|
||||
|
||||
@@ -72,7 +73,7 @@ public class TextAttributes implements Cloneable {
|
||||
|
||||
private TextAttributes(@NotNull AttributesFlyweight attributesFlyweight, boolean enforced) {
|
||||
myAttrs = attributesFlyweight;
|
||||
myEnforcedDefaults = enforced;
|
||||
myEnforceEmpty = enforced;
|
||||
}
|
||||
|
||||
public TextAttributes(@NotNull Element element) {
|
||||
@@ -97,11 +98,11 @@ public class TextAttributes implements Cloneable {
|
||||
}
|
||||
|
||||
public boolean isFallbackEnabled() {
|
||||
return isEmpty() && !myEnforcedDefaults;
|
||||
return isEmpty() && !myEnforceEmpty;
|
||||
}
|
||||
|
||||
public boolean containsValue() {
|
||||
return !isEmpty() || myEnforcedDefaults;
|
||||
return !isEmpty() || myEnforceEmpty;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -178,7 +179,7 @@ public class TextAttributes implements Cloneable {
|
||||
|
||||
@Override
|
||||
public TextAttributes clone() {
|
||||
return new TextAttributes(myAttrs, myEnforcedDefaults);
|
||||
return new TextAttributes(myAttrs, myEnforceEmpty);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
@@ -202,7 +203,7 @@ public class TextAttributes implements Cloneable {
|
||||
}
|
||||
|
||||
if (isEmpty()) {
|
||||
myEnforcedDefaults = true;
|
||||
myEnforceEmpty = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +217,12 @@ public class TextAttributes implements Cloneable {
|
||||
getEffectColor() + "," + getErrorStripeColor() + "]";
|
||||
}
|
||||
|
||||
public void setEnforcedDefaults(boolean enforcedDefaults) {
|
||||
myEnforcedDefaults = enforcedDefaults;
|
||||
/**
|
||||
* Enforces empty attributes instead of treating empty values as undefined.
|
||||
*
|
||||
* @param enforceEmpty True if empty values should be used as is (fallback is disabled).
|
||||
*/
|
||||
public void setEnforceEmpty(boolean enforceEmpty) {
|
||||
myEnforceEmpty = enforceEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class TextAttributesReader extends ValueElementReader {
|
||||
FontStyle.read(this, element));
|
||||
// needed for compatibility with TextAttributes(Element)
|
||||
if (attributes.isEmpty()) {
|
||||
attributes.setEnforcedDefaults(true);
|
||||
attributes.setEnforceEmpty(true);
|
||||
}
|
||||
}
|
||||
//noinspection unchecked
|
||||
|
||||
+1
-1
@@ -108,6 +108,6 @@ public abstract class TextAttributesDescription extends ColorAndFontDescription
|
||||
@Override
|
||||
public void setInherited(boolean isInherited) {
|
||||
super.setInherited(isInherited);
|
||||
myAttributes.setEnforcedDefaults(!isInherited);
|
||||
myAttributes.setEnforceEmpty(!isInherited);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user