本文整理匯總了Java中com.intellij.openapi.editor.markup.TextAttributes.isFallbackEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java TextAttributes.isFallbackEnabled方法的具體用法?Java TextAttributes.isFallbackEnabled怎麽用?Java TextAttributes.isFallbackEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.editor.markup.TextAttributes
的用法示例。
在下文中一共展示了TextAttributes.isFallbackEnabled方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public TextAttributes getAttributes(TextAttributesKey key) {
if (key != null) {
TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
TextAttributes attributes = getDirectlyDefinedAttributes(key);
if (fallbackKey == null) {
if (containsValue(attributes)) return attributes;
}
else {
if (containsValue(attributes) && !attributes.isFallbackEnabled()) return attributes;
attributes = getFallbackAttributes(fallbackKey);
if (containsValue(attributes)) return attributes;
}
}
return myParentScheme.getAttributes(key);
}
示例2: isInherited
import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
public boolean isInherited(TextAttributesKey key) {
TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
if (fallbackKey != null) {
if (myParentScheme instanceof AbstractColorsScheme) {
TextAttributes ownAttrs = ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key);
if (ownAttrs != null) {
return ownAttrs.isFallbackEnabled();
}
}
TextAttributes attributes = getAttributes(key);
if (attributes != null) {
TextAttributes fallbackAttributes = getAttributes(fallbackKey);
return attributes == fallbackAttributes;
}
}
return false;
}
示例3: getAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
@Nullable
public TextAttributes getAttributes(TextAttributesKey key) {
if (key == null) return null;
TextAttributes attrs = myAttributesMap.get(key);
if (attrs == null) {
if (key.getFallbackAttributeKey() != null) {
attrs = getFallbackAttributes(key.getFallbackAttributeKey());
if (attrs != null && !attrs.isFallbackEnabled()) return attrs;
}
attrs = key.getDefaultAttributes();
}
return attrs;
}
示例4: setMissingUndefinedAttributesForVersion142
import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
/**
* Defines empty attributes with fallback (inheritance) enabled for all the attributes explicitly defined in the parent scheme since
* previously undefined attributes were treated as inherited, not taken from the parent scheme.
*/
private void setMissingUndefinedAttributesForVersion142() {
if (myOriginalVersion >= 142 || myParentScheme == null) return;
if (myParentScheme instanceof AbstractColorsScheme) {
for (TextAttributesKey key : ((AbstractColorsScheme)myParentScheme).myAttributesMap.keySet()) {
TextAttributes parentAttributes = ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key);
if (parentAttributes != null &&
!parentAttributes.isFallbackEnabled() &&
!myAttributesMap.containsKey(key)) {
myAttributesMap.put(key, new TextAttributes());
}
}
}
}
示例5: writeAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void writeAttributes(Element attrElements) throws WriteExternalException {
List<TextAttributesKey> list = new ArrayList<TextAttributesKey>(myAttributesMap.keySet());
Collections.sort(list);
for (TextAttributesKey key: list) {
TextAttributes defaultAttr = myParentScheme != null ? myParentScheme.getAttributes(key) : new TextAttributes();
TextAttributesKey baseKey = key.getFallbackAttributeKey();
TextAttributes defaultFallbackAttr =
baseKey != null && myParentScheme instanceof AbstractColorsScheme ?
((AbstractColorsScheme)myParentScheme).getFallbackAttributes(baseKey) : null;
TextAttributes value = myAttributesMap.get(key);
Element element = new Element(OPTION_ELEMENT);
element.setAttribute(NAME_ATTR, key.getExternalName());
if (baseKey != null && value.isFallbackEnabled()) {
if (defaultFallbackAttr != null && defaultAttr != null && defaultAttr != defaultFallbackAttr) {
element.setAttribute(BASE_ATTRIBUTES_ATTR, baseKey.getExternalName());
attrElements.addContent(element);
}
}
else {
if (value.containsValue() && !value.equals(defaultAttr) || defaultAttr == defaultFallbackAttr) {
Element valueElement = new Element(VALUE_ELEMENT);
value.writeExternal(valueElement);
element.addContent(valueElement);
attrElements.addContent(element);
}
}
}
}
示例6: getFallbackAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
protected TextAttributes getFallbackAttributes(TextAttributesKey fallbackKey) {
if (fallbackKey == null) return null;
TextAttributes fallbackAttributes = getDirectlyDefinedAttributes(fallbackKey);
if (fallbackAttributes != null) {
if (!fallbackAttributes.isFallbackEnabled() || fallbackKey.getFallbackAttributeKey() == null) {
return fallbackAttributes;
}
}
return getFallbackAttributes(fallbackKey.getFallbackAttributeKey());
}