com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter Java Examples
The following examples show how to use
com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SyntaxHighlighterOverEditorHighlighter.java From consulo with Apache License 2.0 | 6 votes |
public SyntaxHighlighterOverEditorHighlighter(SyntaxHighlighter _highlighter, VirtualFile file, Project project) { if (file.getFileType() == PlainTextFileType.INSTANCE) { // optimization for large files, PlainTextSyntaxHighlighterFactory is slow highlighter = new PlainSyntaxHighlighter(); lexer = highlighter.getHighlightingLexer(); } else { highlighter = _highlighter; LayeredLexer.ourDisableLayersFlag.set(Boolean.TRUE); EditorHighlighter editorHighlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(project, file); try { if (editorHighlighter instanceof LayeredLexerEditorHighlighter) { lexer = new LexerEditorHighlighterLexer(editorHighlighter, false); } else { lexer = highlighter.getHighlightingLexer(); } } finally { LayeredLexer.ourDisableLayersFlag.set(null); } } }
Example #2
Source File: FileTemplateConfigurable.java From consulo with Apache License 2.0 | 6 votes |
private EditorHighlighter createHighlighter() { if (myTemplate != null && myVelocityFileType != UnknownFileType.INSTANCE) { 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 = PlainTextFileType.INSTANCE; } 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; }