private static @Nullable Content getToolWindowContent(@NotNull AnActionEvent e) {
    // note to future readers: TW tab "pinned" icon is shown when content.getUserData(TW.SHOW_CONTENT_ICON) is true
    ToolWindow window = e.getData(PlatformDataKeys.TOOL_WINDOW);
    if (window == null) return null;

    Component component = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT);
    BaseLabel obj = ComponentUtil.getParentOfType(BaseLabel.class, component);
    Content result = obj == null ? null : obj.getContent();
    if (result == null) {
      InternalDecoratorImpl decorator = InternalDecoratorImpl.findNearestDecorator(component);
      if (decorator != null) {
        result = decorator.getContentManager().getSelectedContent();
      }
    }
    return result != null && result.isPinnable() ? result : null;
  }
private static @Nullable Content getToolWindowContent(@NotNull AnActionEvent e)