Search in sources :

Example 1 with FileLevelIntentionComponent

use of com.intellij.codeInsight.intention.impl.FileLevelIntentionComponent in project intellij-community by JetBrains.

the class DaemonCodeAnalyzerImpl method addFileLevelHighlight.

@Override
public void addFileLevelHighlight(@NotNull final Project project, final int group, @NotNull final HighlightInfo info, @NotNull final PsiFile psiFile) {
    VirtualFile vFile = psiFile.getViewProvider().getVirtualFile();
    final FileEditorManager manager = FileEditorManager.getInstance(project);
    for (FileEditor fileEditor : manager.getEditors(vFile)) {
        if (fileEditor instanceof TextEditor) {
            FileLevelIntentionComponent component = new FileLevelIntentionComponent(info.getDescription(), info.getSeverity(), info.getGutterIconRenderer(), info.quickFixActionRanges, project, psiFile, ((TextEditor) fileEditor).getEditor(), info.getToolTip());
            manager.addTopComponent(fileEditor, component);
            List<HighlightInfo> fileLevelInfos = fileEditor.getUserData(FILE_LEVEL_HIGHLIGHTS);
            if (fileLevelInfos == null) {
                fileLevelInfos = new ArrayList<>();
                fileEditor.putUserData(FILE_LEVEL_HIGHLIGHTS, fileLevelInfos);
            }
            info.fileLevelComponent = component;
            info.setGroup(group);
            fileLevelInfos.add(info);
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) FileLevelIntentionComponent(com.intellij.codeInsight.intention.impl.FileLevelIntentionComponent)

Aggregations

FileLevelIntentionComponent (com.intellij.codeInsight.intention.impl.FileLevelIntentionComponent)1 FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 TextEditor (com.intellij.openapi.fileEditor.TextEditor)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1