EA-71665 - IAE: ContentManagerImpl.setSelectedContent
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 14 Aug 2015 17:28:28 +0000 (20:28 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 14 Aug 2015 17:32:26 +0000 (20:32 +0300)
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java

index df0dcd9a16e41e616d7c1c8937106e80d75ec4c8..ea923753097b093180dd51b195284ad66afd89fd 100644 (file)
@@ -37,6 +37,8 @@ import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.ui.AppIcon;
 import com.intellij.ui.content.Content;
+import com.intellij.ui.content.ContentManager;
+import com.intellij.util.ArrayUtil;
 import com.intellij.util.ui.UIUtil;
 import com.intellij.xdebugger.XDebuggerBundle;
 import org.jetbrains.annotations.NotNull;
@@ -102,8 +104,10 @@ public abstract class DebuggerSessionTabBase extends RunTab {
           ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager()
             .getToolWindowByDescriptor(myRunContentDescriptor);
           Content content = myRunContentDescriptor.getAttachedContent();
-          if (toolWindow != null && content != null && !toolWindow.getContentManager().isSelected(content)) {
-            toolWindow.getContentManager().setSelectedContent(content);
+          if (toolWindow == null || content == null) return;
+          ContentManager manager = toolWindow.getContentManager();
+          if (ArrayUtil.contains(content, manager.getContents()) && !manager.isSelected(content)) {
+            manager.setSelectedContent(content);
           }
         }
       }