xdebugger: reuse toolwindow activation if needed

This commit is contained in:
Sergey Simonchik
2014-08-06 17:26:55 +04:00
parent bbea9fb5ce
commit fe6e325fad
3 changed files with 14 additions and 9 deletions
@@ -262,7 +262,7 @@ public class XDebugSessionImpl implements XDebugSession {
return myCurrentPosition;
}
public XDebugSessionTab init(final XDebugProcess process, @NotNull final XDebugSessionData sessionData) {
public XDebugSessionTab init(@NotNull XDebugProcess process, @NotNull XDebugSessionData sessionData, @Nullable RunContentDescriptor contentToReuse) {
LOG.assertTrue(myDebugProcess == null);
myDebugProcess = process;
mySessionData = sessionData;
@@ -280,7 +280,7 @@ public class XDebugSessionImpl implements XDebugSession {
//todo[nik] make 'createConsole()' method return ConsoleView
myConsoleView = (ConsoleView)myDebugProcess.createConsole();
if (!myShowTabOnSuspend) {
initSessionTab();
initSessionTab(contentToReuse);
}
return mySessionTab;
@@ -319,8 +319,8 @@ public class XDebugSessionImpl implements XDebugSession {
return mySessionTab.getUi();
}
private void initSessionTab() {
mySessionTab = new XDebugSessionTab(myProject, this, myIcon, myEnvironment, myRunner);
private void initSessionTab(@Nullable RunContentDescriptor contentToReuse) {
mySessionTab = new XDebugSessionTab(myProject, this, myIcon, myEnvironment, myRunner, contentToReuse);
myDebugProcess.sessionInitialized();
}
@@ -799,7 +799,7 @@ public class XDebugSessionImpl implements XDebugSession {
public void run() {
if (myShowTabOnSuspend) {
myShowTabOnSuspend = false;
initSessionTab();
initSessionTab(null);
showSessionTab();
}
if (myCurrentPosition != null) {
@@ -206,8 +206,9 @@ public class XDebuggerManagerImpl extends XDebuggerManager
return session;
}
private XDebugSessionImpl startSession(final RunContentDescriptor contentToReuse, final XDebugProcessStarter processStarter,
final XDebugSessionImpl session) throws ExecutionException {
private XDebugSessionImpl startSession(@Nullable RunContentDescriptor contentToReuse,
@NotNull XDebugProcessStarter processStarter,
@NotNull XDebugSessionImpl session) throws ExecutionException {
XDebugProcess process = processStarter.start(session);
myProject.getMessageBus().syncPublisher(TOPIC).processStarted(process);
@@ -222,7 +223,7 @@ public class XDebuggerManagerImpl extends XDebuggerManager
((XDebugProcessConfiguratorStarter)processStarter).configure(oldSessionData);
}
session.init(process, oldSessionData);
session.init(process, oldSessionData, contentToReuse);
mySessions.put(session.getDebugProcess().getProcessHandler(), session);
@@ -68,7 +68,8 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
@NotNull XDebugSessionImpl session,
@Nullable Icon icon,
@Nullable ExecutionEnvironment environment,
@Nullable ProgramRunner runner) {
@Nullable ProgramRunner runner,
@Nullable RunContentDescriptor contentToReuse) {
super(project, "Debug", session.getSessionName(), GlobalSearchScope.allScope(project));
if (environment != null) {
setEnvironment(environment);
@@ -76,6 +77,9 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
myConsole = session.getConsoleView();
XDebugProcess debugProcess = session.getDebugProcess();
myRunContentDescriptor = new RunContentDescriptor(myConsole, debugProcess.getProcessHandler(), myUi.getComponent(), mySessionName, icon);
if (contentToReuse != null && contentToReuse.isReuseToolWindowActivation()) {
myRunContentDescriptor.setActivateToolWindowWhenAdded(contentToReuse.isActivateToolWindowWhenAdded());
}
attachToSession(session, runner, environment, session.getSessionData(), debugProcess);
}