Search in sources :

Example 1 with LayerDescriptor

use of com.intellij.openapi.editor.ex.util.LayerDescriptor 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 LayerDescriptor

use of com.intellij.openapi.editor.ex.util.LayerDescriptor in project intellij-community by JetBrains.

the class FileTemplateConfigurable method createHighlighter.

private EditorHighlighter createHighlighter() {
    if (myTemplate != null && myVelocityFileType != FileTypes.UNKNOWN) {
        return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft"));
    }
    FileType fileType = null;
    if (myTemplate != null) {
        fileType = FileTypeManager.getInstance().getFileTypeByExtension(myTemplate.getExtension());
    }
    if (fileType == null) {
        fileType = FileTypes.PLAIN_TEXT;
    }
    SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
    if (originalHighlighter == null) {
        originalHighlighter = new PlainSyntaxHighlighter();
    }
    final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
    LayeredLexerEditorHighlighter highlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), scheme);
    highlighter.registerLayer(FileTemplateTokenType.TEXT, new LayerDescriptor(originalHighlighter, ""));
    return highlighter;
}
Also used : LayeredLexerEditorHighlighter(com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) LayerDescriptor(com.intellij.openapi.editor.ex.util.LayerDescriptor)

Example 3 with LayerDescriptor

use of com.intellij.openapi.editor.ex.util.LayerDescriptor in project intellij-community by JetBrains.

the class GroovyEditorHighlighter method registerGroovydocHighlighter.

private void registerGroovydocHighlighter() {
    // Register GroovyDoc Highlighter
    SyntaxHighlighter groovyDocHighlighter = new GroovyDocSyntaxHighlighter();
    final LayerDescriptor groovyDocLayer = new LayerDescriptor(groovyDocHighlighter, "\n", GroovySyntaxHighlighter.DOC_COMMENT_CONTENT);
    registerLayer(GroovyDocElementTypes.GROOVY_DOC_COMMENT, groovyDocLayer);
}
Also used : GroovyDocSyntaxHighlighter(org.jetbrains.plugins.groovy.lang.groovydoc.highlighter.GroovyDocSyntaxHighlighter) SyntaxHighlighter(com.intellij.openapi.fileTypes.SyntaxHighlighter) GroovyDocSyntaxHighlighter(org.jetbrains.plugins.groovy.lang.groovydoc.highlighter.GroovyDocSyntaxHighlighter) LayerDescriptor(com.intellij.openapi.editor.ex.util.LayerDescriptor)

Aggregations

LayerDescriptor (com.intellij.openapi.editor.ex.util.LayerDescriptor)3 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 LayeredLexerEditorHighlighter (com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter)2 PlainSyntaxHighlighter (com.intellij.openapi.fileTypes.PlainSyntaxHighlighter)1 SyntaxHighlighter (com.intellij.openapi.fileTypes.SyntaxHighlighter)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1 GroovyDocSyntaxHighlighter (org.jetbrains.plugins.groovy.lang.groovydoc.highlighter.GroovyDocSyntaxHighlighter)1