com.intellij.lang.annotation.ExternalAnnotator Java Examples
The following examples show how to use
com.intellij.lang.annotation.ExternalAnnotator.
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: ExternalToolPass.java From consulo with Apache License 2.0 | 6 votes |
@RequiredReadAction @Override public void doCollectInformation(@Nonnull ProgressIndicator progress) { myDocumentChanged = false; final FileViewProvider viewProvider = myFile.getViewProvider(); final Set<Language> relevantLanguages = viewProvider.getLanguages(); for (Language language : relevantLanguages) { PsiFile psiRoot = viewProvider.getPsi(language); if (!HighlightingLevelManager.getInstance(myProject).shouldInspect(psiRoot)) continue; final List<ExternalAnnotator> externalAnnotators = ExternalLanguageAnnotators.allForFile(language, psiRoot); if (!externalAnnotators.isEmpty()) { DaemonCodeAnalyzerEx daemonCodeAnalyzer = DaemonCodeAnalyzerEx.getInstanceEx(myProject); boolean errorFound = daemonCodeAnalyzer.getFileStatusMap().wasErrorFound(myDocument); for(ExternalAnnotator externalAnnotator: externalAnnotators) { final Object collectedInfo = externalAnnotator.collectInformation(psiRoot, myEditor, errorFound); if (collectedInfo != null) { myAnnotator2DataMap.put(externalAnnotator, new MyData(psiRoot, collectedInfo)); } } } } }
Example #2
Source File: ExternalLanguageAnnotators.java From consulo with Apache License 2.0 | 5 votes |
public static List<ExternalAnnotator> allForFile(Language language, final PsiFile file) { List<ExternalAnnotator> annotators = INSTANCE.allForLanguage(language); final List<ExternalAnnotatorsFilter> filters = ExternalAnnotatorsFilter.EXTENSION_POINT_NAME.getExtensionList(); return ContainerUtil.findAll(annotators, new Condition<ExternalAnnotator>() { @Override public boolean value(ExternalAnnotator annotator) { for (ExternalAnnotatorsFilter filter : filters) { if (filter.isProhibited(annotator, file)) { return false; } } return true; } }); }
Example #3
Source File: ExternalToolPass.java From consulo with Apache License 2.0 | 5 votes |
public ExternalToolPass(@Nonnull ExternalToolPassFactory externalToolPassFactory, @Nonnull PsiFile file, @Nonnull Editor editor, int startOffset, int endOffset) { super(file.getProject(), editor.getDocument(), false); myEditor = editor; myFile = file; myStartOffset = startOffset; myEndOffset = endOffset; myAnnotationHolder = new AnnotationHolderImpl(new AnnotationSession(file)); myAnnotator2DataMap = new HashMap<ExternalAnnotator, MyData>(); myExternalToolPassFactory = externalToolPassFactory; }
Example #4
Source File: ExternalToolPass.java From consulo with Apache License 2.0 | 5 votes |
private void collectHighlighters() { for (ExternalAnnotator annotator : myAnnotator2DataMap.keySet()) { final MyData data = myAnnotator2DataMap.get(annotator); if (data != null) { annotator.apply(data.myPsiRoot, data.myAnnotationResult, myAnnotationHolder); } } }
Example #5
Source File: ExternalToolPass.java From consulo with Apache License 2.0 | 5 votes |
private void doAnnotate() { for (ExternalAnnotator annotator : myAnnotator2DataMap.keySet()) { final MyData data = myAnnotator2DataMap.get(annotator); if (data != null) { data.myAnnotationResult = annotator.doAnnotate(data.myCollectedInfo); } } }
Example #6
Source File: ExternalToolPassFactory.java From consulo with Apache License 2.0 | 5 votes |
private static boolean externalAnnotatorsDefined(@Nonnull PsiFile file) { for (Language language : file.getViewProvider().getLanguages()) { final List<ExternalAnnotator> externalAnnotators = ExternalLanguageAnnotators.allForFile(language, file); if (!externalAnnotators.isEmpty()) { return true; } } return false; }
Example #7
Source File: ExternalAnnotatorsFilter.java From consulo with Apache License 2.0 | votes |
boolean isProhibited(ExternalAnnotator annotator, PsiFile file);