Search in sources :

Example 6 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme 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();
}
Also used : TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) EditorColorsManager(com.intellij.openapi.editor.colors.EditorColorsManager) TextAttributesKey(com.intellij.openapi.editor.colors.TextAttributesKey)

Example 7 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme 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();
}
Also used : TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) EditorColorsManager(com.intellij.openapi.editor.colors.EditorColorsManager) TextAttributesKey(com.intellij.openapi.editor.colors.TextAttributesKey)

Example 8 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme 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();
}
Also used : TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) EditorColorsManager(com.intellij.openapi.editor.colors.EditorColorsManager) TextAttributesKey(com.intellij.openapi.editor.colors.TextAttributesKey)

Example 9 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class CodeStyleAbstractPanel method updatePreviewHighlighter.

private void updatePreviewHighlighter(final EditorEx editor) {
    EditorColorsScheme scheme = editor.getColorsScheme();
    editor.getSettings().setCaretRowShown(false);
    editor.setHighlighter(createHighlighter(scheme));
}
Also used : EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme)

Example 10 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class DefaultHighlightInfoProcessor method highlightsOutsideVisiblePartAreProduced.

@Override
public void highlightsOutsideVisiblePartAreProduced(@NotNull final HighlightingSession session, @NotNull final List<HighlightInfo> infos, @NotNull final TextRange priorityRange, @NotNull final TextRange restrictedRange, final int groupId) {
    final PsiFile psiFile = session.getPsiFile();
    final Project project = psiFile.getProject();
    final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
    if (document == null)
        return;
    final long modificationStamp = document.getModificationStamp();
    ((HighlightingSessionImpl) session).applyInEDT(() -> {
        if (project.isDisposed() || modificationStamp != document.getModificationStamp())
            return;
        EditorColorsScheme scheme = session.getColorsScheme();
        UpdateHighlightersUtil.setHighlightersOutsideRange(project, document, psiFile, infos, scheme, restrictedRange.getStartOffset(), restrictedRange.getEndOffset(), ProperTextRange.create(priorityRange), groupId);
        Editor editor = session.getEditor();
        if (editor != null) {
            DaemonListeners.repaintErrorStripeRenderer(editor, project);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) PsiFile(com.intellij.psi.PsiFile) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor)

Aggregations

EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)103 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)31 NotNull (org.jetbrains.annotations.NotNull)28 EditorColorsManager (com.intellij.openapi.editor.colors.EditorColorsManager)17 Nullable (org.jetbrains.annotations.Nullable)15 Document (com.intellij.openapi.editor.Document)14 Project (com.intellij.openapi.project.Project)14 TextAttributesKey (com.intellij.openapi.editor.colors.TextAttributesKey)12 Editor (com.intellij.openapi.editor.Editor)11 DocumentMarkupModel (com.intellij.openapi.editor.impl.DocumentMarkupModel)10 EditorEx (com.intellij.openapi.editor.ex.EditorEx)8 TextRange (com.intellij.openapi.util.TextRange)8 EditorHighlighter (com.intellij.openapi.editor.highlighter.EditorHighlighter)7 PsiFile (com.intellij.psi.PsiFile)7 List (java.util.List)7 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)6 ApplicationManager (com.intellij.openapi.application.ApplicationManager)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 java.awt (java.awt)6 java.util (java.util)6