@NotNull
  public static HierarchyBrowser createAndAddToPanel(@NotNull Project project,
                                                     @NotNull HierarchyProvider provider,
                                                     @NotNull PsiElement target) {
    HierarchyBrowser hierarchyBrowser = provider.createHierarchyBrowser(target);

    HierarchyBrowserManager hierarchyBrowserManager = HierarchyBrowserManager.getInstance(project);

    ContentManager contentManager = hierarchyBrowserManager.getContentManager();
    Content selectedContent = contentManager.getSelectedContent();

    JComponent browserComponent = hierarchyBrowser.getComponent();

    if (selectedContent != null && !selectedContent.isPinned()) {
      contentManager.removeContent(selectedContent, true);
    }
    Content content = ContentFactory.getInstance().createContent(browserComponent, null, true);
    if (!DumbService.isDumbAware(hierarchyBrowser)) {
      browserComponent = DumbService.getInstance(project).wrapGently(browserComponent, content);
      content.setComponent(browserComponent);
    }
    contentManager.addContent(content);

    content.setHelpId(HierarchyBrowserBaseEx.HELP_ID);
    contentManager.setSelectedContent(content);
    hierarchyBrowser.setContent(content);

    Runnable runnable = () -> {
      if (hierarchyBrowser instanceof HierarchyBrowserBase && ((HierarchyBrowserBase)hierarchyBrowser).isDisposed()) {
        return;
      }
      provider.browserActivated(hierarchyBrowser);
    };
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY);
    toolWindow.activate(runnable);
    if (hierarchyBrowser instanceof Disposable) {
      Disposer.register(content, (Disposable)hierarchyBrowser);
    }
    return hierarchyBrowser;
  }
@NotNull
  public static HierarchyBrowser createAndAddToPanel(@NotNull Project project,
                                                     @NotNull HierarchyProvider provider,
                                                     @NotNull PsiElement target)