use of com.intellij.openapi.editor.colors.TextAttributesKey in project intellij-community by JetBrains.
the class ResourceBundlePropertyStructureViewElement method getPresentation.
@Override
@NotNull
public ItemPresentation getPresentation() {
return new ResourceBundleEditorRenderer.TextAttributesPresentation() {
@Override
public String getPresentableText() {
return myPresentableName == null ? getProperty().getName() : myPresentableName.isEmpty() ? PROPERTY_GROUP_KEY_TEXT : myPresentableName;
}
@Override
public String getLocationString() {
return null;
}
@Override
public Icon getIcon(boolean open) {
return PlatformIcons.PROPERTY_ICON;
}
@Override
public TextAttributes getTextAttributes(EditorColorsScheme colorsScheme) {
final TextAttributesKey baseAttrKey = (myPresentableName != null && myPresentableName.isEmpty()) ? GROUP_KEY : PropertiesHighlighter.PROPERTY_KEY;
final TextAttributes baseAttrs = colorsScheme.getAttributes(baseAttrKey);
if (getProperty().getPsiElement().isValid()) {
if (myInspectedPropertyProblems != null) {
TextAttributes highlightingAttributes = myInspectedPropertyProblems.getTextAttributes(colorsScheme);
if (highlightingAttributes != null) {
return TextAttributes.merge(baseAttrs, highlightingAttributes);
}
}
}
return baseAttrs;
}
};
}
use of com.intellij.openapi.editor.colors.TextAttributesKey in project intellij-community by JetBrains.
the class ComponentTree method getAttribute.
private SimpleTextAttributes getAttribute(@NotNull final SimpleTextAttributes attrs, @Nullable HighlightDisplayLevel level) {
if (level == null) {
return attrs;
}
Map<SimpleTextAttributes, SimpleTextAttributes> highlightMap = myHighlightAttributes.get(level.getSeverity());
if (highlightMap == null) {
highlightMap = new HashMap<>();
myHighlightAttributes.put(level.getSeverity(), highlightMap);
}
SimpleTextAttributes result = highlightMap.get(attrs);
if (result == null) {
final TextAttributesKey attrKey = SeverityRegistrar.getSeverityRegistrar(myProject).getHighlightInfoTypeBySeverity(level.getSeverity()).getAttributesKey();
TextAttributes textAttrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attrKey);
textAttrs = TextAttributes.merge(attrs.toTextAttributes(), textAttrs);
result = SimpleTextAttributes.fromTextAttributes(textAttrs);
highlightMap.put(attrs, result);
}
return result;
}
use of com.intellij.openapi.editor.colors.TextAttributesKey in project intellij-community by JetBrains.
the class EclipseColorSchemeImporter method setupMissingColors.
private static void setupMissingColors(@NotNull EditorColorsScheme scheme) {
Color background = scheme.getDefaultBackground();
String defaultSchemeName = ColorUtil.isDark(background) ? "Darcula" : EditorColorsScheme.DEFAULT_SCHEME_NAME;
EditorColorsScheme baseScheme = DefaultColorSchemesManager.getInstance().getScheme(defaultSchemeName);
assert baseScheme != null : "Can not find default scheme '" + defaultSchemeName + "'!";
for (TextAttributesKey attributesKey : ATTRIBUTES_TO_COPY) {
copyAttributes(baseScheme, scheme, attributesKey);
}
for (String keyName : EXTERNAL_ATTRIBUTES) {
TextAttributesKey key = TextAttributesKey.createTextAttributesKey(keyName);
copyAttributes(baseScheme, scheme, key);
}
Color lightForeground = ColorUtil.mix(background, scheme.getDefaultForeground(), 0.5);
scheme.setColor(EditorColors.WHITESPACES_COLOR, lightForeground);
scheme.setColor(EditorColors.INDENT_GUIDE_COLOR, lightForeground);
scheme.setColor(EditorColors.SOFT_WRAP_SIGN_COLOR, lightForeground);
TextAttributes matchedBrace = new TextAttributes();
matchedBrace.setEffectType(EffectType.BOXED);
matchedBrace.setEffectColor(lightForeground);
scheme.setAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES, matchedBrace);
TextAttributes unmatchedBrace = matchedBrace.clone();
unmatchedBrace.setEffectColor(ColorUtil.mix(background, Color.RED, 0.5));
}
use of com.intellij.openapi.editor.colors.TextAttributesKey in project intellij-community by JetBrains.
the class PythonHighlightingTest method testDeclarations.
public void testDeclarations() {
EditorColorsManager manager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
manager.addColorsScheme(scheme);
EditorColorsManager.getInstance().setGlobalScheme(scheme);
TextAttributesKey xKey = TextAttributesKey.find("PY.CLASS_DEFINITION");
TextAttributes xAttributes = new TextAttributes(Color.blue, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
xKey = TextAttributesKey.find("PY.FUNC_DEFINITION");
xAttributes = new TextAttributes(Color.red, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
xKey = TextAttributesKey.find("PY.PREDEFINED_DEFINITION");
xAttributes = new TextAttributes(Color.green, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
doTest();
}
Aggregations