private void doCreateToolWindow(@NotNull PsiElement element, PsiElement originalElement, boolean onAutoUpdate) {
    Language language = element.getLanguage();
    assert myLangToolWindows.get(language.getID()) == null;

    DocToolWindowManager toolWindowManager = DocToolWindowManager.LANGUAGE_MANAGER.forLanguage(language);
    if (toolWindowManager == null) {
      doCreateDefaultToolWindow(element, originalElement);
      return;
    }
    else if (onAutoUpdate && !toolWindowManager.isAutoUpdateAvailable()) {
      return;
    }

    ToolWindow toolWindow = toolWindowManager.createToolWindow(element, originalElement, this);
    DocumentationComponent component = toolWindowManager.getDocumentationComponent(toolWindow, this);
    if (component == null) {
      // If failed create language toolwindow - create default
      doCreateDefaultToolWindow(element, originalElement);
      return;
    }
    myToolWindow = toolWindow;
    myLangToolWindows.put(language.getID(), toolWindow);

    toolWindow.setAvailable(true);
    toolWindow.setToHideOnEmptyContent(false);
    toolWindow.show(null);

    toolWindowManager.installToolWindowActions(toolWindow, this);
    toolWindowManager.setToolWindowDefaultState(toolWindow, this);
    toolWindowManager.prepareForShowDocumentation(toolWindow, this);
    toolWindowManager.updateToolWindowDocumentationTabName(toolWindow, element, this);

    ContentManager contentManager = toolWindow.getContentManager();
    contentManager.addContentManagerListener(new ContentManagerListener() {
      @Override
      public void contentRemoved(@NotNull ContentManagerEvent event) {
        if (event.getContent().getComponent() == component) {
          restorePopupBehavior();
        }
      }
    });

    UiNotifyConnector.installOn(component, new Activatable() {
      @Override
      public void showNotify() {
        restartAutoUpdate(PropertiesComponent.getInstance().getBoolean(getAutoUpdateEnabledProperty(), getAutoUpdateDefault()));
      }

      @Override
      public void hideNotify() {
        restartAutoUpdate(false);
      }
    });

    PropertiesComponent.getInstance().setValue(getShowInToolWindowProperty(), Boolean.TRUE.toString());
    restartAutoUpdate(PropertiesComponent.getInstance().getBoolean(getAutoUpdateEnabledProperty(), true));
    doUpdateComponent(element, originalElement, component, onAutoUpdate);
  }
private void doCreateToolWindow(@NotNull PsiElement element, PsiElement originalElement, boolean onAutoUpdate)