cidr-debugger: tests
authorAnton Makeev <Anton.Makeev@jetbrains.com>
Sat, 24 Apr 2010 17:15:03 +0000 (21:15 +0400)
committerAnton Makeev <Anton.Makeev@jetbrains.com>
Mon, 26 Apr 2010 06:36:11 +0000 (10:36 +0400)
java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java [moved from platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerLogConsoleManagerBase.java with 88% similarity]
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java

index 3a5fb7b01e5f60cd1f3c982a99f1e5ae50f0d163..4a71d7f56ebd8e3906cda56a08e1fc79239cf349 100644 (file)
@@ -65,7 +65,7 @@ import com.intellij.unscramble.ThreadDumpPanel;
 import com.intellij.unscramble.ThreadState;
 import com.intellij.xdebugger.XDebuggerBundle;
 import com.intellij.xdebugger.impl.actions.XDebuggerActions;
-import com.intellij.xdebugger.impl.ui.DebuggerLogConsoleManagerBase;
+import com.intellij.xdebugger.impl.ui.DebuggerSessionTabBase;
 import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
 import org.jetbrains.annotations.Nullable;
 
@@ -74,7 +74,7 @@ import javax.swing.tree.TreePath;
 import java.util.Collection;
 import java.util.List;
 
-public class DebuggerSessionTab extends DebuggerLogConsoleManagerBase implements Disposable {
+public class DebuggerSessionTab extends DebuggerSessionTabBase implements Disposable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerSessionTab");
 
   private static final Icon WATCH_RETURN_VALUES_ICON = IconLoader.getIcon("/debugger/watchLastReturnValue.png");
@@ -83,12 +83,9 @@ public class DebuggerSessionTab extends DebuggerLogConsoleManagerBase implements
   private final VariablesPanel myVariablesPanel;
   private final MainWatchPanel myWatchPanel;
 
-  private ExecutionConsole myConsole;
   private ProgramRunner myRunner;
   private volatile DebuggerSession myDebuggerSession;
 
-  private RunContentDescriptor myRunContentDescriptor;
-
   private final MyDebuggerStateManager myStateManager = new MyDebuggerStateManager();
 
   private final FramesPanel myFramesPanel;
@@ -420,13 +417,6 @@ public class DebuggerSessionTab extends DebuggerLogConsoleManagerBase implements
     }
   }
 
-  protected void toFront() {
-    if (!ApplicationManager.getApplication().isUnitTestMode()) {
-      ExecutionManager.getInstance(getProject()).getContentManager().toFrontRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor);
-      ProjectUtil.focusProjectWindow(getProject(), Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"));
-    }
-  }
-
   public String getSessionName() {
     return myConfiguration.getName();
   }
similarity index 88%
rename from platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerLogConsoleManagerBase.java
rename to platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java
index 50630341ffaf6088dd3a79d017dbd0a4aa2ea52b..907b66e14cb640a5ffb50e6d13c9fac1f61c3d59 100644 (file)
 package com.intellij.xdebugger.impl.ui;
 
 import com.intellij.diagnostic.logging.*;
+import com.intellij.execution.ExecutionManager;
 import com.intellij.execution.configurations.RunConfigurationBase;
 import com.intellij.execution.configurations.RunProfile;
+import com.intellij.execution.executors.DefaultDebugExecutor;
 import com.intellij.execution.process.ProcessHandler;
 import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.execution.runners.ProgramRunner;
+import com.intellij.execution.ui.ExecutionConsole;
 import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.execution.ui.RunnerLayoutUi;
+import com.intellij.ide.impl.ProjectUtil;
 import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.ComponentWithActions;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.IconLoader;
 import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentManagerAdapter;
 import com.intellij.ui.content.ContentManagerEvent;
@@ -46,16 +53,20 @@ import java.util.Map;
 /**
  * @author nik
  */
-public abstract class DebuggerLogConsoleManagerBase implements DebuggerLogConsoleManager, Disposable {
+public abstract class DebuggerSessionTabBase implements DebuggerLogConsoleManager, Disposable {
   private final Map<AdditionalTabComponent, Content> myAdditionalContent = new HashMap<AdditionalTabComponent, Content>();
   private final Map<AdditionalTabComponent, ContentManagerListener> myContentListeners =
     new HashMap<AdditionalTabComponent, ContentManagerListener>();
   private final Project myProject;
   private final LogFilesManager myManager;
   protected ExecutionEnvironment myEnvironment;
+
+  protected ExecutionConsole myConsole;
+  protected RunContentDescriptor myRunContentDescriptor;
+
   private final Icon DEFAULT_TAB_COMPONENT_ICON = IconLoader.getIcon("/fileTypes/text.png");
 
-  public DebuggerLogConsoleManagerBase(Project project) {
+  public DebuggerSessionTabBase(Project project) {
     myProject = project;
     myManager = new LogFilesManager(project, this, this);
   }
@@ -186,6 +197,13 @@ public abstract class DebuggerLogConsoleManagerBase implements DebuggerLogConsol
     getUi().removeContent(content, true);
   }
 
+  public void toFront() {
+    if (!ApplicationManager.getApplication().isUnitTestMode()) {
+      ExecutionManager.getInstance(getProject()).getContentManager().toFrontRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor);
+      ProjectUtil.focusProjectWindow(getProject(), Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"));
+    }
+  }
+
   protected Project getProject() {
     return myProject;
   }
index 1394ae1756ca7b435d1181919dbb5d2efff073ac..af3f06c391c1839d939b80df4820ac2259a80f17 100644 (file)
@@ -60,11 +60,9 @@ import java.util.List;
 /**
  * @author spleaner
  */
-public class XDebugSessionTab extends DebuggerLogConsoleManagerBase {
+public class XDebugSessionTab extends DebuggerSessionTabBase {
   private final String mySessionName;
   private final RunnerLayoutUi myUi;
-  private RunContentDescriptor myRunContentDescriptor;
-  private ExecutionConsole myConsole;
   private XWatchesView myWatchesView;
   private final List<XDebugViewBase> myViews = new ArrayList<XDebugViewBase>();
 
@@ -176,6 +174,7 @@ public class XDebugSessionTab extends DebuggerLogConsoleManagerBase {
                                       final @Nullable ExecutionEnvironment environment, final @Nullable ProgramRunner runner) {
     ExecutionResult executionResult = createExecutionResult(session);
     myConsole = executionResult.getExecutionConsole();
+    myRunContentDescriptor = new RunContentDescriptor(myConsole, executionResult.getProcessHandler(), myUi.getComponent(), getSessionName());
 
     myUi.addContent(createFramesContent(session), 0, PlaceInGrid.left, false);
     myUi.addContent(createVariablesContent(session), 0, PlaceInGrid.center, false);
@@ -194,7 +193,6 @@ public class XDebugSessionTab extends DebuggerLogConsoleManagerBase {
     }
     session.getDebugProcess().registerAdditionalContent(myUi);
 
-    myRunContentDescriptor = new RunContentDescriptor(myConsole, executionResult.getProcessHandler(), myUi.getComponent(), getSessionName());
 
     if (ApplicationManager.getApplication().isUnitTestMode()) {
       return myRunContentDescriptor;
@@ -256,13 +254,4 @@ public class XDebugSessionTab extends DebuggerLogConsoleManagerBase {
   public RunContentDescriptor getRunContentDescriptor() {
     return myRunContentDescriptor;
   }
-
-  public void toFront() {
-    ApplicationManager.getApplication().invokeLater(new Runnable() {
-      public void run() {
-        ProjectUtil.focusProjectWindow(getProject(), Registry.is("debugger.mayBringFrameToFrontOnBreakpoint"));
-        ExecutionManager.getInstance(getProject()).getContentManager().toFrontRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor);
-      }
-    });
-  }
 }
\ No newline at end of file