@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
    boolean processed = false;
    if (contentManager != null && contentManager.canCloseContents()) {
      final Content selectedContent = contentManager.getSelectedContent();
      if (selectedContent != null && selectedContent.isCloseable()) {
        contentManager.removeContent(selectedContent, true);
        processed = true;
      }
    }

    if (!processed && contentManager != null) {
      DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
      ToolWindow toolWindow = PlatformDataKeys.TOOL_WINDOW.getData(context);
      if (toolWindow != null) {
        toolWindow.hide(null);
      }
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)