Search in sources :

Example 1 with GeneralHighlightingPass

use of com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass in project intellij-community by JetBrains.

the class DomUIFactoryImpl method createDomHighlighter.

@Override
public BackgroundEditorHighlighter createDomHighlighter(final Project project, final PerspectiveFileEditor editor, final DomElement element) {
    return new BackgroundEditorHighlighter() {

        @Override
        @NotNull
        public HighlightingPass[] createPassesForEditor() {
            if (!element.isValid())
                return HighlightingPass.EMPTY_ARRAY;
            final XmlFile psiFile = DomUtil.getFile(element);
            final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
            final Document document = psiDocumentManager.getDocument(psiFile);
            if (document == null)
                return HighlightingPass.EMPTY_ARRAY;
            editor.commit();
            GeneralHighlightingPass ghp = new GeneralHighlightingPass(project, psiFile, document, 0, document.getTextLength(), true, new ProperTextRange(0, document.getTextLength()), null, new DefaultHighlightInfoProcessor());
            LocalInspectionsPass lip = new LocalInspectionsPass(psiFile, document, 0, document.getTextLength(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE, true, new DefaultHighlightInfoProcessor());
            return new HighlightingPass[] { ghp, lip };
        }

        @Override
        @NotNull
        public HighlightingPass[] createPassesForVisibleArea() {
            return createPassesForEditor();
        }
    };
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) LocalInspectionsPass(com.intellij.codeInsight.daemon.impl.LocalInspectionsPass) ProperTextRange(com.intellij.openapi.util.ProperTextRange) BackgroundEditorHighlighter(com.intellij.codeHighlighting.BackgroundEditorHighlighter) Document(com.intellij.openapi.editor.Document) DefaultHighlightInfoProcessor(com.intellij.codeInsight.daemon.impl.DefaultHighlightInfoProcessor) HighlightingPass(com.intellij.codeHighlighting.HighlightingPass) GeneralHighlightingPass(com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass) PsiDocumentManager(com.intellij.psi.PsiDocumentManager) GeneralHighlightingPass(com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass)

Aggregations

BackgroundEditorHighlighter (com.intellij.codeHighlighting.BackgroundEditorHighlighter)1 HighlightingPass (com.intellij.codeHighlighting.HighlightingPass)1 DefaultHighlightInfoProcessor (com.intellij.codeInsight.daemon.impl.DefaultHighlightInfoProcessor)1 GeneralHighlightingPass (com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass)1 LocalInspectionsPass (com.intellij.codeInsight.daemon.impl.LocalInspectionsPass)1 Document (com.intellij.openapi.editor.Document)1 ProperTextRange (com.intellij.openapi.util.ProperTextRange)1 PsiDocumentManager (com.intellij.psi.PsiDocumentManager)1 XmlFile (com.intellij.psi.xml.XmlFile)1