static List<HighlightInfo> doHighlighting(final Disposable context, final EditorEx editor, final PsiFile psiFile) { final DaemonProgressIndicator progress = new DaemonProgressIndicator(); Disposer.register(context, progress); return ProgressManager.getInstance().runProcess(new Computable<List<HighlightInfo>>() { @Override public List<HighlightInfo> compute() { final Project project = psiFile.getProject(); final DaemonCodeAnalyzerEx analyzer = DaemonCodeAnalyzerEx.getInstanceEx(project); // ensure we get fresh results; the restart also seems to // prevent the "process canceled" issue (see #30) PsiDocumentManager.getInstance(project).commitAllDocuments(); analyzer.restart(psiFile); // analyze! return analyzer.runMainPasses( psiFile, editor.getDocument(), progress); } }, progress); }
/** * Depending on the type of task (Modal or Backgroundable), it will prepare related UI and execute the task in the current thread * or in the executor. * It needs to be called from EDT because of the creation of the Indicator. */ private void runTask(SonarLintTask task) { if (myProject.isDisposed()) { return; } notifyStart(task.getJob()); if (task.isConditionalModal() || task.isModal()) { progressManager.run(task); } else { ProgressIndicator progressIndicator = new BackgroundableProcessIndicator(task); executor.submit(() -> progressManager.runProcess(() -> task.run(progressIndicator), progressIndicator)); } }
final VirtualFile virtualBaseDirectory = LocalFileSystem.getInstance().findFileByIoFile(baseDirectory); ProgressManager.getInstance().runProcess(new Runnable() { @Override public void run() {
ProgressManager.getInstance().runProcess(new Runnable() { @Override public void run() {