void (@NotNull final Project project, @NotNull final Editor editor, @NotNull final VirtualFile file) { final AnnotationData data = extractData(project, file); assert data != null; final AnnotationProviderEx provider = (AnnotationProviderEx)data.vcs.getAnnotationProvider(); assert provider != null; final Ref<FileAnnotation> fileAnnotationRef = new Ref<>(); final Ref<VcsException> exceptionRef = new Ref<>(); final BackgroundableActionLock actionLock = VcsAnnotateUtil.getBackgroundableLock(project, file); actionLock.lock(); final Task.Backgroundable annotateTask = new Task.Backgroundable(project, VcsBundle.message("retrieving.annotations"), true) { @Override public void run(final @NotNull ProgressIndicator indicator) { try { fileAnnotationRef.set(provider.annotate(data.filePath, data.revisionNumber)); } catch (VcsException e) { exceptionRef.set(e); } catch (ProcessCanceledException pce) { throw pce; } catch (Throwable t) { exceptionRef.set(new VcsException(t)); } } @Override public void onCancel() { onSuccess(); } @Override public void onSuccess() { if (!exceptionRef.isNull()) { LOG.warn(exceptionRef.get()); AbstractVcsHelper.getInstance(project) .showErrors(Collections.singletonList(exceptionRef.get()), VcsBundle.message("message.title.annotate")); } if (!fileAnnotationRef.isNull()) { AnnotateToggleAction.doAnnotate(editor, project, fileAnnotationRef.get(), data.vcs); } } @Override public void onFinished() { actionLock.unlock(); } }; ProgressManager.getInstance().run(annotateTask); }