protected void doShowJavaDocInfo(@NotNull PsiElement element,
                                   boolean requestFocus,
                                   @NotNull PopupUpdateProcessor updateProcessor,
                                   PsiElement originalElement,
                                   @Nullable Runnable closeCallback,
                                   @Nullable ActionCallback actionCallback,
                                   @Nullable @Nls String documentation,
                                   boolean useStoredPopupSize,
                                   boolean onAutoUpdate) {
    if (!myProject.isOpen()) return;

    ReadAction.run(() -> {
      assertSameProject(element);
      storeOriginalElement(myProject, originalElement, element);
    });

    JBPopup prevHint = getDocInfoHint();

    Language language = element.getLanguage();
    ToolWindow newToolWindow;
    DocToolWindowManager toolWindowManager = DocToolWindowManager.LANGUAGE_MANAGER.forLanguage(language);
    if (toolWindowManager == null) {
      newToolWindow = myDefaultDocToolWindow;
    }
    else {
      newToolWindow = myLangToolWindows.get(language.getID());
    }

    myPrecalculatedDocumentation = documentation;
    if (newToolWindow == null && PropertiesComponent.getInstance().isTrueValue(SHOW_DOCUMENTATION_IN_TOOL_WINDOW)) {
      createToolWindow(element, originalElement, onAutoUpdate);
    }
    else if (newToolWindow != null) {
      myToolWindow = newToolWindow;
      Content content;
      if (toolWindowManager != null) {
        content = toolWindowManager.getDocumentationContent(myToolWindow, this);
      }
      else {
        content = myToolWindow.getContentManager().getSelectedContent();
      }
      if (content != null) {
        DocumentationComponent component = (DocumentationComponent)content.getComponent();
        boolean sameElement = element.getManager().areElementsEquivalent(component.getElement(), element);
        if (sameElement) {
          JComponent preferredFocusableComponent = content.getPreferredFocusableComponent();
          // focus toolwindow on the second actionPerformed
          boolean focus = requestFocus || CommandProcessor.getInstance().getCurrentCommand() != null;
          if (preferredFocusableComponent != null && focus) {
            IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusableComponent, true);
          }
        }
        if (!sameElement || !component.isUpToDate()) {
          cancelAndFetchDocInfo(component, new MyCollector(myProject, element, originalElement, null, actionCallback, false, onAutoUpdate))
            .doWhenDone(() -> component.clearHistory());
        }
      }

      if (!myToolWindow.isVisible()) {
        myToolWindow.show(null);
      }
    }
    else if (prevHint != null && prevHint.isVisible() && prevHint instanceof AbstractPopup) {
      DocumentationComponent component = (DocumentationComponent)((AbstractPopup)prevHint).getComponent();
      ActionCallback result =
        cancelAndFetchDocInfo(component, new MyCollector(myProject, element, originalElement, null, actionCallback, false, false));
      if (requestFocus) {
        result.doWhenDone(() -> {
          JBPopup hint = getDocInfoHint();
          if (hint != null) ((AbstractPopup)hint).focusPreferredComponent();
        });
      }
    }
    else {
      showInPopup(element, requestFocus, updateProcessor, originalElement, closeCallback, actionCallback, useStoredPopupSize);
    }
  }
protected void doShowJavaDocInfo(@NotNull PsiElement element,
                                   boolean requestFocus,
                                   @NotNull PopupUpdateProcessor updateProcessor,
                                   PsiElement originalElement,
                                   @Nullable Runnable closeCallback,
                                   @Nullable ActionCallback actionCallback,
                                   @Nullable @Nls String documentation,
                                   boolean useStoredPopupSize,
                                   boolean onAutoUpdate)