private void chooseRootAndAnnotateExternally(VirtualFile @NotNull [] roots, @NotNull ExternalAnnotation annotation) {
    if (roots.length > 1) {
      JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<>(JavaBundle.message("external.annotations.roots"), roots) {
        @Override
        public void canceled() {
          notifyAfterAnnotationChanging(annotation.getOwner(), annotation.getAnnotationFQName(), false);
        }

        @Override
        public PopupStep<?> onChosen(@NotNull VirtualFile file, final boolean finalChoice) {
          annotateExternally(file, annotation);
          return FINAL_CHOICE;
        }

        @Override
        public @NotNull String getTextFor(@NotNull VirtualFile value) {
          return value.getPresentableUrl();
        }

        @Override
        public Icon getIconFor(final VirtualFile aValue) {
          return AllIcons.Modules.Annotation;
        }
      }).showInBestPositionFor(DataManager.getInstance().getDataContext());
    }
    else {
      annotateExternally(roots[0], annotation);
    }
  }
private void chooseRootAndAnnotateExternally(VirtualFile @NotNull [] roots, @NotNull ExternalAnnotation annotation)