Search in sources :

Example 11 with LexerEditorHighlighter

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

Example 12 with LexerEditorHighlighter

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

the class GuiEditor method showFormSource.

public void showFormSource() {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Editor editor = editorFactory.createViewer(myDocument, myProject);
    try {
        ((EditorEx) editor).setHighlighter(new LexerEditorHighlighter(new XmlFileHighlighter(), EditorColorsManager.getInstance().getGlobalScheme()));
        JComponent component = editor.getComponent();
        component.setPreferredSize(new Dimension(640, 480));
        DialogBuilder dialog = new DialogBuilder(myProject);
        dialog.title("Form - " + myFile.getPresentableName()).dimensionKey("GuiDesigner.FormSource.Dialog");
        dialog.centerPanel(component).setPreferredFocusComponent(editor.getContentComponent());
        dialog.addOkAction();
        dialog.show();
    } finally {
        editorFactory.releaseEditor(editor);
    }
}
Also used : EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorEx(com.intellij.openapi.editor.ex.EditorEx) LexerEditorHighlighter(com.intellij.openapi.editor.ex.util.LexerEditorHighlighter) XmlFileHighlighter(com.intellij.ide.highlighter.XmlFileHighlighter) UIFormEditor(com.intellij.uiDesigner.editor.UIFormEditor) Editor(com.intellij.openapi.editor.Editor) DialogBuilder(com.intellij.openapi.ui.DialogBuilder)

Aggregations

LexerEditorHighlighter (com.intellij.openapi.editor.ex.util.LexerEditorHighlighter)12 SyntaxHighlighter (com.intellij.openapi.fileTypes.SyntaxHighlighter)5 EditorHighlighter (com.intellij.openapi.editor.highlighter.EditorHighlighter)4 NotNull (org.jetbrains.annotations.NotNull)4 EditorWindow (com.intellij.injected.editor.EditorWindow)3 EditorEx (com.intellij.openapi.editor.ex.EditorEx)3 TextRange (com.intellij.openapi.util.TextRange)3 Language (com.intellij.lang.Language)2 Editor (com.intellij.openapi.editor.Editor)2 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 RangeHighlighterEx (com.intellij.openapi.editor.ex.RangeHighlighterEx)2 EditorUtil (com.intellij.openapi.editor.ex.util.EditorUtil)2 HighlighterIterator (com.intellij.openapi.editor.highlighter.HighlighterIterator)2 EffectType (com.intellij.openapi.editor.markup.EffectType)2 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)2 Processor (com.intellij.util.Processor)2 ContainerUtil (com.intellij.util.containers.ContainerUtil)2 java.awt (java.awt)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2