public static void mergeTabs(@NotNull ContentManager manager, @NotNull TabGroupId groupId) {
    List<TabDescriptor> tabs = new ArrayList<>();
    Content selectedContent = manager.getSelectedContent();
    TabDescriptor selectedTab = null;
    List<Content> mergedContent = new ArrayList<>();
    for (Content content : manager.getContents()) {
      if (groupId.equals(content.getUserData(Content.TAB_GROUP_ID_KEY))) {
        TabDescriptor tab = content.getUserData(Content.TAB_DESCRIPTOR_KEY);
        if (tab == null) {
          tab = new TabDescriptor(content.getComponent(), content.getDisplayName().substring(groupId.getDisplayName().length() + 2));
        }
        if (content == selectedContent) {
          selectedTab = tab;
        }
        tabs.add(tab);
        manager.removeContent(content, false);
        content.setComponent(null);
        content.setShouldDisposeContent(false);
        mergedContent.add(content);
      }
    }

    setSplitMode(groupId.getId(), false);
    createMergedTabbedContent(manager, groupId, tabs, selectedTab, selectedTab != null);

    mergedContent.forEach(Disposer::dispose);
  }
public static void mergeTabs(@NotNull ContentManager manager, @NotNull TabGroupId groupId)