Search in sources :

Example 1 with PlainSyntaxHighlighter

use of com.intellij.openapi.fileTypes.PlainSyntaxHighlighter in project intellij-community by JetBrains.

the class TemplateEditorUtil method setHighlighter.

private static void setHighlighter(EditorEx editor, @Nullable SyntaxHighlighter highlighter) {
    EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
    LayeredLexerEditorHighlighter layeredHighlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), editorColorsScheme);
    layeredHighlighter.registerLayer(TemplateTokenType.TEXT, new LayerDescriptor(ObjectUtils.notNull(highlighter, new PlainSyntaxHighlighter()), ""));
    editor.setHighlighter(layeredHighlighter);
}
Also used : LayeredLexerEditorHighlighter(com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) LayerDescriptor(com.intellij.openapi.editor.ex.util.LayerDescriptor) PlainSyntaxHighlighter(com.intellij.openapi.fileTypes.PlainSyntaxHighlighter)

Example 2 with PlainSyntaxHighlighter

use of com.intellij.openapi.fileTypes.PlainSyntaxHighlighter in project intellij-community by JetBrains.

the class LanguagePanel method updateHighlighters.

void updateHighlighters() {
    final EditorImpl editor = ((EditorImpl) myPrefix.getEditor());
    if (editor == null)
        return;
    final EditorImpl editor2 = ((EditorImpl) mySuffix.getEditor());
    assert editor2 != null;
    final Language language = InjectedLanguage.findLanguageById(getLanguage());
    if (language == null) {
        editor.setHighlighter(new LexerEditorHighlighter(new PlainSyntaxHighlighter(), editor.getColorsScheme()));
        editor2.setHighlighter(new LexerEditorHighlighter(new PlainSyntaxHighlighter(), editor.getColorsScheme()));
    } else {
        final SyntaxHighlighter s1 = SyntaxHighlighterFactory.getSyntaxHighlighter(language, myProject, null);
        final SyntaxHighlighter s2 = SyntaxHighlighterFactory.getSyntaxHighlighter(language, myProject, null);
        editor.setHighlighter(new LexerEditorHighlighter(s1, editor.getColorsScheme()));
        editor2.setHighlighter(new LexerEditorHighlighter(s2, editor2.getColorsScheme()));
    }
}
Also used : Language(com.intellij.lang.Language) InjectedLanguage(org.intellij.plugins.intelliLang.inject.InjectedLanguage) EditorImpl(com.intellij.openapi.editor.impl.EditorImpl) LexerEditorHighlighter(com.intellij.openapi.editor.ex.util.LexerEditorHighlighter) PlainSyntaxHighlighter(com.intellij.openapi.fileTypes.PlainSyntaxHighlighter) SyntaxHighlighter(com.intellij.openapi.fileTypes.SyntaxHighlighter) PlainSyntaxHighlighter(com.intellij.openapi.fileTypes.PlainSyntaxHighlighter)

Aggregations

PlainSyntaxHighlighter (com.intellij.openapi.fileTypes.PlainSyntaxHighlighter)2 Language (com.intellij.lang.Language)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 LayerDescriptor (com.intellij.openapi.editor.ex.util.LayerDescriptor)1 LayeredLexerEditorHighlighter (com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter)1 LexerEditorHighlighter (com.intellij.openapi.editor.ex.util.LexerEditorHighlighter)1 EditorImpl (com.intellij.openapi.editor.impl.EditorImpl)1 SyntaxHighlighter (com.intellij.openapi.fileTypes.SyntaxHighlighter)1 InjectedLanguage (org.intellij.plugins.intelliLang.inject.InjectedLanguage)1