Search in sources :

Example 11 with DaemonCodeAnalyzer

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

the class StatusBarUpdater method updateStatus.

private void updateStatus() {
    Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
    if (editor == null || !editor.getContentComponent().hasFocus()) {
        return;
    }
    final Document document = editor.getDocument();
    if (document instanceof DocumentEx && ((DocumentEx) document).isInBulkUpdate())
        return;
    int offset = editor.getCaretModel().getOffset();
    DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
    HighlightInfo info = ((DaemonCodeAnalyzerImpl) codeAnalyzer).findHighlightByOffset(document, offset, false, MIN);
    String text = info != null && info.getDescription() != null ? info.getDescription() : "";
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject);
    if (statusBar != null && !text.equals(statusBar.getInfo())) {
        statusBar.setInfo(text, "updater");
    }
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) Editor(com.intellij.openapi.editor.Editor) Document(com.intellij.openapi.editor.Document) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 12 with DaemonCodeAnalyzer

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

the class ShowErrorDescriptionAction method isEnabledForFile.

private static boolean isEnabledForFile(Project project, Editor editor, PsiFile file) {
    DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project);
    HighlightInfo info = ((DaemonCodeAnalyzerImpl) codeAnalyzer).findHighlightByOffset(editor.getDocument(), editor.getCaretModel().getOffset(), false);
    return info != null && info.getDescription() != null;
}
Also used : DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) HighlightInfo(com.intellij.codeInsight.daemon.impl.HighlightInfo) DaemonCodeAnalyzerImpl(com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl)

Aggregations

DaemonCodeAnalyzer (com.intellij.codeInsight.daemon.DaemonCodeAnalyzer)12 Project (com.intellij.openapi.project.Project)5 PsiFile (com.intellij.psi.PsiFile)4 Document (com.intellij.openapi.editor.Document)2 Editor (com.intellij.openapi.editor.Editor)2 PsiElement (com.intellij.psi.PsiElement)2 DaemonCodeAnalyzerImpl (com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl)1 HighlightInfo (com.intellij.codeInsight.daemon.impl.HighlightInfo)1 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)1 IntentionHintComponent (com.intellij.codeInsight.intention.impl.IntentionHintComponent)1 InspectionProfileImpl (com.intellij.codeInspection.ex.InspectionProfileImpl)1 InspectionProfileWrapper (com.intellij.codeInspection.ex.InspectionProfileWrapper)1 Language (com.intellij.lang.Language)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Application (com.intellij.openapi.application.Application)1 HectorComponentPanel (com.intellij.openapi.editor.HectorComponentPanel)1 DocumentEx (com.intellij.openapi.editor.ex.DocumentEx)1 MarkupModelEx (com.intellij.openapi.editor.ex.MarkupModelEx)1 RangeHighlighterEx (com.intellij.openapi.editor.ex.RangeHighlighterEx)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1