@@ -0,0 +1,2271 @@
+/*%0A * Copyright 2000-2014 JetBrains s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.intellij.util;%0A%0Aimport com.intellij.openapi.Disposable;%0Aimport com.intellij.openapi.util.Comparing;%0Aimport com.intellij.openapi.util.Disposer;%0Aimport com.intellij.openapi.util.Pair;%0Aimport com.intellij.ui.content.Content;%0Aimport com.intellij.ui.content.ContentManager;%0Aimport com.intellij.ui.content.TabbedContent;%0Aimport com.intellij.ui.content.impl.TabbedContentImpl;%0A%0Aimport javax.swing.*;%0Aimport java.util.ArrayList;%0A%0A/**%0A * @author Konstantin Bulenkov%0A */%0Apublic class ContentUtilEx extends ContentsUtil %7B%0A  public static void addTabbedContent(ContentManager manager, JComponent contentComponent, String groupPrefix, String tabName, boolean select) %7B%0A    TabbedContent tabbedContent = null;%0A    for (Content content : manager.getContents()) %7B%0A      if (content instanceof TabbedContent && content.getTabName().startsWith(groupPrefix + %22: %22)) %7B%0A        tabbedContent = (TabbedContent)content;%0A        break;%0A      %7D%0A    %7D%0A%0A    if (tabbedContent == null) %7B%0A      final Disposable disposable = Disposer.newDisposable();%0A      tabbedContent = new TabbedContentImpl(contentComponent, tabName, true, groupPrefix);%0A      ContentsUtil.addOrReplaceContent(manager, tabbedContent, select);%0A      Disposer.register(tabbedContent, disposable);%0A    %7D else %7B%0A      for (Pair%3CString, JComponent%3E tab : new ArrayList%3CPair%3CString, JComponent%3E%3E(tabbedContent.getTabs())) %7B%0A        if (Comparing.equal(tab.second, contentComponent)) %7B%0A          tabbedContent.removeContent(tab.second);%0A        %7D%0A      %7D%0A      if (select) %7B%0A        manager.setSelectedContent(tabbedContent, true, true);%0A      %7D%0A      tabbedContent.addContent(contentComponent, tabName, true);%0A    %7D%0A  %7D%0A%7D%0A

add utility class to work with tabbed content