Java Code Examples for com.intellij.openapi.editor.markup.TextAttributes#isFallbackEnabled()

The following examples show how to use com.intellij.openapi.editor.markup.TextAttributes#isFallbackEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultColorsScheme.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public TextAttributes getAttributes(TextAttributesKey key) {
  if (key != null) {
    TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
    TextAttributes attributes = myAttributesMap.get(key);
    if (fallbackKey == null) {
      if (attributes != null) return attributes;
    }
    else {
      if (attributes != null && !attributes.isFallbackEnabled()) return attributes;
      attributes = getFallbackAttributes(fallbackKey);
      if (attributes != null) return attributes;
    }
  }
  return myParentScheme == null ? null : myParentScheme.getAttributes(key);
}
 
Example 2
Source File: EditorColorsSchemeImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public TextAttributes getAttributes(TextAttributesKey key) {
  if (key != null) {
    TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
    TextAttributes attributes = myAttributesMap.get(key);
    if (fallbackKey == null) {
      if (attributes != null) return attributes;
    }
    else {
      if (attributes != null && !attributes.isFallbackEnabled()) return attributes;
      attributes = getFallbackAttributes(fallbackKey);
      if (attributes != null) return attributes;
    }
  }
  return myParentScheme.getAttributes(key);
}
 
Example 3
Source File: AbstractColorsScheme.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected TextAttributes getFallbackAttributes(TextAttributesKey fallbackKey) {
  if (fallbackKey == null) return null;
  if (myAttributesMap.containsKey(fallbackKey)) {
    TextAttributes fallbackAttributes = myAttributesMap.get(fallbackKey);
    if (fallbackAttributes != null && (!fallbackAttributes.isFallbackEnabled() || fallbackKey.getFallbackAttributeKey() == null)) {
      return fallbackAttributes;
    }
  }
  return getFallbackAttributes(fallbackKey.getFallbackAttributeKey());
}
 
Example 4
Source File: AbstractColorsScheme.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean haveToWrite(final TextAttributesKey key, final TextAttributes value, final TextAttributes defaultAttribute) {
  return !(key.getFallbackAttributeKey() != null && value.isFallbackEnabled()) && !value.equals(defaultAttribute);
}