@Override
      public void run() throws RuntimeException {
        if (project.isDisposed()) return;
        if (DumbService.isDumb(project)) {
          DumbService.getInstance(project).runWhenSmart(() -> WriteCommandAction.writeCommandAction(project).run(this));
          return;
        }
        try {
          for (Map.Entry<Optional<VirtualFile>, List<ExternalAnnotation>> entry : annotationsByFiles.entrySet()) {
            VirtualFile annotationsFile = entry.getKey().orElse(null);
            if (annotationsFile == null) continue;
            List<ExternalAnnotation> fileAnnotations = entry.getValue();
            PsiFile file = PsiManager.getInstance(project).findFile(annotationsFile);
            if (file instanceof XmlFile) {
              annotateExternally((XmlFile)file, fileAnnotations);
            }
          }

          UndoManager.getInstance(project).undoableActionPerformed(new BasicUndoableAction() {
            @Override
            public void undo() {
              dropAnnotationsCache();
              notifyChangedExternally();
            }

            @Override
            public void redo() {
              dropAnnotationsCache();
              notifyChangedExternally();
            }
          });
        }
        finally {
          dropAnnotationsCache();
        }
      }
@Override
      public void run()