analyzeFile(dartFile, context.getProject());
}
}
private void analyzeFile(@NotNull final VirtualFile virtualFile, @NotNull final Project project) {
final DartInProcessAnnotator annotator = new DartInProcessAnnotator();
final DartInProcessAnnotator.DartAnnotatorInfo annotatorInfo =
ApplicationManager.getApplication().runReadAction(new NullableComputable<DartInProcessAnnotator.DartAnnotatorInfo>() {
@Nullable
public DartInProcessAnnotator.DartAnnotatorInfo compute() {
final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
if (psiFile == null) return null;
return annotator.collectInformation(psiFile);
}
});
if (annotatorInfo == null) {
return;
}
setIndicatorText("Analyzing " + virtualFile.getName() + "...");
final AnalysisContext analysisContext = annotator.doAnnotate(annotatorInfo);
if (analysisContext == null) return;
libraryRoot2Errors.put(virtualFile, analysisContext.getErrors(DartFileBasedSource.getSource(project, virtualFile)).getErrors());
}