void (@NotNull final ViewerAnnotator annotator) { final DiffViewerBase viewer = annotator.getViewer(); final Project project = viewer.getProject(); if (project == null) return; final FileAnnotationLoader loader = annotator.createAnnotationsLoader(); if (loader == null) return; final DiffContextEx diffContext = ObjectUtils.tryCast(viewer.getContext(), DiffContextEx.class); annotator.getBackgroundableLock().lock(); if (diffContext != null) diffContext.showProgressBar(true); BackgroundTaskUtil.executeOnPooledThread(viewer, () -> { try { loader.run(); } finally { ApplicationManager.getApplication().invokeLater(() -> { if (diffContext != null) diffContext.showProgressBar(false); annotator.getBackgroundableLock().unlock(); VcsException exception = loader.getException(); if (exception != null) { Notification notification = VcsNotifier.IMPORTANT_ERROR_NOTIFICATION .createNotification(VcsBundle.message("notification.title.cant.load.annotations"), exception.getMessage(), NotificationType.ERROR) .setDisplayId(VcsNotificationIdsHolder.CANNOT_LOAD_ANNOTATIONS); showNotification(viewer, notification); LOG.warn(exception); return; } if (loader.getResult() == null) return; if (viewer.isDisposed()) return; annotator.showAnnotation(loader.getResult()); }, ProgressManager.getGlobalProgressIndicator().getModalityState()); } }); }