本文整理汇总了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());
}