public static void showExternalJavadoc(PsiElement element, PsiElement originalElement, String docUrl, DataContext dataContext) {
    DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
    if (provider instanceof ExternalDocumentationHandler &&
        ((ExternalDocumentationHandler)provider).handleExternal(element, originalElement)) {
      return;
    }
    Project project = dataContext.getData(CommonDataKeys.PROJECT);
    final Component contextComponent = PlatformCoreDataKeys.CONTEXT_COMPONENT.getData(dataContext);
    ApplicationManager.getApplication().executeOnPooledThread(() -> {
      List<String> urls;
      if (StringUtil.isEmptyOrSpaces(docUrl)) {
        urls = ReadAction.compute(() -> provider.getUrlFor(element, originalElement));
      }
      else {
        urls = Collections.singletonList(docUrl);
      }
      if (provider instanceof ExternalDocumentationProvider && urls != null && urls.size() > 1) {
        for (String url : urls) {
          List<String> thisUrlList = Collections.singletonList(url);
          String doc = ((ExternalDocumentationProvider)provider).fetchExternalDocumentation(project, element, thisUrlList, false);
          if (doc != null) {
            urls = thisUrlList;
            break;
          }
        }
      }
      final List<String> finalUrls = urls;
      ApplicationManager.getApplication().invokeLater(() -> {
        if (ContainerUtil.isEmpty(finalUrls)) {
          if (element != null && provider instanceof ExternalDocumentationProvider externalDocumentationProvider) {
            if (externalDocumentationProvider.canPromptToConfigureDocumentation(element)) {
              externalDocumentationProvider.promptToConfigureDocumentation(element);
            }
          }
        }
        else if (finalUrls.size() == 1) {
          BrowserUtil.browse(finalUrls.get(0));
        }
        else {
          JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<>(
            LangBundle.message("popup.title.choose.external.documentation.root"),
            ArrayUtilRt.toStringArray(finalUrls)) {
            @Override
            public PopupStep<?> onChosen(final String selectedValue, final boolean finalChoice) {
              BrowserUtil.browse(selectedValue);
              return FINAL_CHOICE;
            }
          }).showInBestPositionFor(DataManager.getInstance().getDataContext(contextComponent));
        }
      }, ModalityState.nonModal());
    });

  }
public static void showExternalJavadoc(PsiElement element, PsiElement originalElement, String docUrl, DataContext dataContext)