use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class XmlTagInplaceRenamer method addHighlights.
private static void addHighlights(List<TextRange> ranges, Editor editor, ArrayList<RangeHighlighter> highlighters) {
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
final TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
final HighlightManager highlightManager = HighlightManager.getInstance(editor.getProject());
for (final TextRange range : ranges) {
highlightManager.addOccurrenceHighlight(editor, range.getStartOffset(), range.getEndOffset(), attributes, 0, highlighters, null);
}
for (RangeHighlighter highlighter : highlighters) {
highlighter.setGreedyToLeft(true);
highlighter.setGreedyToRight(true);
}
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class GroovyRefactoringUtil method highlightOccurrences.
public static void highlightOccurrences(Project project, @Nullable Editor editor, PsiElement[] elements) {
if (editor == null)
return;
ArrayList<RangeHighlighter> highlighters = new ArrayList<>();
HighlightManager highlightManager = HighlightManager.getInstance(project);
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
if (elements.length > 0) {
highlightManager.addOccurrenceHighlights(editor, elements, attributes, false, highlighters);
}
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class PythonHighlightingTest method testMagicMethods.
// PY-19927
public void testMagicMethods() {
EditorColorsManager manager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
manager.addColorsScheme(scheme);
EditorColorsManager.getInstance().setGlobalScheme(scheme);
TextAttributesKey xKey = TextAttributesKey.find("PY.PREDEFINED_DEFINITION");
TextAttributes xAttributes = new TextAttributes(Color.green, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
doTest();
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class PythonHighlightingTest method testBuiltins.
public void testBuiltins() {
EditorColorsManager manager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
manager.addColorsScheme(scheme);
EditorColorsManager.getInstance().setGlobalScheme(scheme);
TextAttributesKey xKey;
TextAttributes xAttributes;
xKey = TextAttributesKey.find("PY.BUILTIN_NAME");
xAttributes = new TextAttributes(Color.green, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
xKey = TextAttributesKey.find("PY.PREDEFINED_USAGE");
xAttributes = new TextAttributes(Color.yellow, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
doTest();
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class PythonHighlightingTest method testYieldInNestedFunction.
public void testYieldInNestedFunction() {
// highlight func declaration first, lest we get an "Extra fragment highlighted" error.
EditorColorsManager manager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
manager.addColorsScheme(scheme);
EditorColorsManager.getInstance().setGlobalScheme(scheme);
TextAttributesKey xKey = TextAttributesKey.find("PY.FUNC_DEFINITION");
TextAttributes xAttributes = new TextAttributes(Color.red, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
doTest();
}
Aggregations