private static @Nullable Content getNonToolWindowContent(@NotNull AnActionEvent e) {
    Content result = null;
    Content[] contents = e.getData(ViewContext.CONTENT_KEY);
    if (contents != null && contents.length == 1) {
      result = contents[0];
    }
    if (result != null && result.isPinnable()) {
      return result;
    }

    ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
    result = contentManager != null? contentManager.getSelectedContent() : null;
    return (result != null && result.isPinnable()) ? result : null;
  }
private static @Nullable Content getNonToolWindowContent(@NotNull AnActionEvent e)