debug api - do not require run configuration and its environment to create debug session and UI (a step to unify with XDebuggerManager)

This commit is contained in:
Michael Golubev
2012-07-23 18:06:52 +02:00
parent 9e39717c36
commit 29c7c56eab
9 changed files with 372 additions and 92 deletions
@@ -0,0 +1,57 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger;
import com.intellij.diagnostic.logging.LogFilesManager;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionResult;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
/**
* Created by IntelliJ IDEA.
* User: michael.golubev
*/
public interface DebugEnvironment {
@Nullable
ExecutionResult createExecutionResult() throws ExecutionException;
GlobalSearchScope getSearchScope();
boolean isRemote();
@Nullable
RunContentDescriptor getReuseContent();
RemoteConnection getRemoteConnection();
boolean isPollConnection();
String getSessionName();
@Nullable
Icon getIcon();
void initContent(RunContentDescriptor content,
LogFilesManager logFilesManager,
DefaultActionGroup group);
}
@@ -54,4 +54,5 @@ public abstract class DebuggerManagerEx extends DebuggerManager {
boolean pollConnection
) throws ExecutionException;
public abstract DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException;
}
@@ -0,0 +1,210 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger;
import com.intellij.diagnostic.logging.LogFilesManager;
import com.intellij.diagnostic.logging.OutputFileUtil;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionResult;
import com.intellij.execution.Executor;
import com.intellij.execution.configurations.*;
import com.intellij.execution.filters.ExceptionFilters;
import com.intellij.execution.filters.Filter;
import com.intellij.execution.filters.TextConsoleBuilder;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.runners.RestartAction;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.actions.CloseAction;
import com.intellij.ide.actions.ContextHelpAction;
import com.intellij.openapi.actionSystem.Constraints;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: michael.golubev
*/
public class DefaultDebugEnvironment implements DebugEnvironment {
private final GlobalSearchScope mySearchScope;
private final Project myProject;
private final Executor myExecutor;
private final ProgramRunner myRunner;
@Nullable private final ExecutionEnvironment myEnvironment;
private RunProfileState myState;
@Nullable private final RunContentDescriptor myReuseContent;
private final RemoteConnection myRemoteConnection;
private final boolean myPollConnection;
private final RunProfile myRunProfile;
public DefaultDebugEnvironment(Project project,
Executor executor,
ProgramRunner runner,
ExecutionEnvironment environment,
RunProfileState state,
@Nullable RunContentDescriptor reuseContent,
RemoteConnection remoteConnection,
boolean pollConnection) {
this(project,
executor,
runner,
environment,
environment.getRunProfile(),
state,
reuseContent,
remoteConnection,
pollConnection);
}
public DefaultDebugEnvironment(Project project,
Executor executor,
ProgramRunner runner,
RunProfile runProfile,
RunProfileState state,
@Nullable RunContentDescriptor reuseContent,
RemoteConnection remoteConnection,
boolean pollConnection) {
this(project,
executor,
runner,
null,
runProfile,
state,
reuseContent,
remoteConnection,
pollConnection);
}
private DefaultDebugEnvironment(Project project,
Executor executor,
ProgramRunner runner,
@Nullable ExecutionEnvironment environment,
RunProfile runProfile,
RunProfileState state,
@Nullable RunContentDescriptor reuseContent,
RemoteConnection remoteConnection,
boolean pollConnection) {
myProject = project;
myExecutor = executor;
myRunner = runner;
myEnvironment = environment;
myRunProfile = runProfile;
myState = state;
myReuseContent = reuseContent;
myRemoteConnection = remoteConnection;
myPollConnection = pollConnection;
Module[] modules = null;
if (myRunProfile instanceof ModuleRunProfile) {
modules = ((ModuleRunProfile)myRunProfile).getModules();
}
if (modules == null || modules.length == 0) {
mySearchScope = GlobalSearchScope.allScope(project);
}
else {
GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
for (int idx = 1; idx < modules.length; idx++) {
Module module = modules[idx];
scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
}
mySearchScope = scope;
}
}
@Override
public ExecutionResult createExecutionResult() throws ExecutionException {
if (myState instanceof CommandLineState) {
final TextConsoleBuilder consoleBuilder = ((CommandLineState)myState).getConsoleBuilder();
if (consoleBuilder != null) {
List<Filter> filters = ExceptionFilters.getFilters(mySearchScope);
for (Filter filter : filters) {
consoleBuilder.addFilter(filter);
}
}
}
return myState.execute(myExecutor, myRunner);
}
@Override
public GlobalSearchScope getSearchScope() {
return mySearchScope;
}
@Override
public boolean isRemote() {
return myState instanceof RemoteState;
}
@Nullable
@Override
public RunContentDescriptor getReuseContent() {
return myReuseContent;
}
@Override
public RemoteConnection getRemoteConnection() {
return myRemoteConnection;
}
@Override
public boolean isPollConnection() {
return myPollConnection;
}
@Override
public String getSessionName() {
return myRunProfile.getName();
}
@Override
public Icon getIcon() {
return myRunProfile.getIcon();
}
@Override
public void initContent(RunContentDescriptor content, LogFilesManager logFilesManager, DefaultActionGroup actionGroup) {
ProcessHandler processHandler = content.getProcessHandler();
if (myRunProfile instanceof RunConfigurationBase) {
RunConfigurationBase runConfiguration = (RunConfigurationBase)myRunProfile;
logFilesManager.registerFileMatcher(runConfiguration);
logFilesManager.initLogConsoles(runConfiguration, processHandler);
OutputFileUtil.attachDumpListener(runConfiguration, processHandler, content.getExecutionConsole());
}
RestartAction restartAction = new RestartAction(myExecutor,
myRunner,
processHandler,
XDebuggerUIConstants.DEBUG_AGAIN_ICON,
content,
myEnvironment);
actionGroup.add(restartAction, Constraints.FIRST);
restartAction.registerShortcut(content.getComponent());
actionGroup.add(new CloseAction(myExecutor, content, myProject));
actionGroup.add(new ContextHelpAction(myExecutor.getHelpId()));
}
}
@@ -16,10 +16,7 @@
package com.intellij.debugger.engine;
import com.intellij.Patches;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.PositionManager;
import com.intellij.debugger.*;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.apiAdapters.ConnectionServiceWrapper;
import com.intellij.debugger.apiAdapters.TransportServiceWrapper;
@@ -764,7 +761,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
protected void closeProcess(boolean closedByUser) {
DebuggerManagerThreadImpl.assertIsManagerThread();
if (myState.compareAndSet(STATE_INITIAL, STATE_DETACHING) || myState.compareAndSet(STATE_ATTACHED, STATE_DETACHING)) {
try {
getManagerThread().close();
@@ -925,7 +922,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
myEvaluationDispatcher.getMulticaster().evaluationStarted(suspendContext);
beforeMethodInvocation(suspendContext, method);
Object resumeData = null;
try {
for (final SuspendContextImpl suspendingContext : suspendingContexts) {
@@ -1638,28 +1635,33 @@ public abstract class DebugProcessImpl implements DebugProcess {
final RunProfileState state,
final RemoteConnection remoteConnection,
boolean pollConnection) throws ExecutionException {
return attachVirtualMachine(new DefaultDebugEnvironment(myProject,
executor,
runner,
state.getRunnerSettings().getRunProfile(),
state,
null,
remoteConnection,
pollConnection),
session);
}
@Nullable
public ExecutionResult attachVirtualMachine(final DebugEnvironment environment,
final DebuggerSession session) throws ExecutionException {
mySession = session;
myWaitFor.down();
ApplicationManager.getApplication().assertIsDispatchThread();
LOG.assertTrue(isInInitialState());
myConnection = remoteConnection;
myConnection = environment.getRemoteConnection();
createVirtualMachine(state, pollConnection);
createVirtualMachine(environment.getSessionName(), environment.isPollConnection());
try {
synchronized (myProcessListeners) {
if (state instanceof CommandLineState) {
final TextConsoleBuilder consoleBuilder = ((CommandLineState)state).getConsoleBuilder();
if (consoleBuilder != null) {
List<Filter> filters = ExceptionFilters.getFilters(session.getSearchScope());
for (Filter filter : filters) {
consoleBuilder.addFilter(filter);
}
}
}
myExecutionResult = state.execute(executor, runner);
myExecutionResult = environment.createExecutionResult();
if (myExecutionResult == null) {
fail();
return null;
@@ -1721,7 +1723,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
stop(false);
}
private void createVirtualMachine(final RunProfileState state, final boolean pollConnection) {
private void createVirtualMachine(final String sessionName, final boolean pollConnection) {
final Semaphore semaphore = new Semaphore();
semaphore.down();
@@ -1763,14 +1765,11 @@ public abstract class DebugProcessImpl implements DebugProcess {
// propagate exception only in case we succeded to obtain execution result,
// otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show
// this problem to the user
final RunProfile runProfile = state.getRunnerSettings().getRunProfile();
if (runProfile != null) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, runProfile, e);
}
});
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, sessionName, e);
}
});
}
break;
}
@@ -71,7 +71,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
private final BreakpointManager myBreakpointManager;
private final List<NameMapper> myNameMappers = ContainerUtil.createEmptyCOWList();
private final List<Function<DebugProcess, PositionManager>> myCustomPositionManagerFactories = new ArrayList<Function<DebugProcess, PositionManager>>();
private final EventDispatcher<DebuggerManagerListener> myDispatcher = EventDispatcher.create(DebuggerManagerListener.class);
private final MyDebuggerStateManager myDebuggerStateManager = new MyDebuggerStateManager();
@@ -182,7 +182,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
myBreakpointManager.writeExternal(element);
}
public DebuggerSession attachVirtualMachine(Executor executor,
ProgramRunner runner,
ModuleRunProfile profile,
@@ -190,6 +190,17 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
RemoteConnection remoteConnection,
boolean pollConnection
) throws ExecutionException {
return attachVirtualMachine(new DefaultDebugEnvironment(myProject,
executor,
runner,
profile,
state,
null,
remoteConnection,
pollConnection));
}
public DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException {
ApplicationManager.getApplication().assertIsDispatchThread();
final DebugProcessEvents debugProcess = new DebugProcessEvents(myProject);
debugProcess.addDebugProcessListener(new DebugProcessAdapter() {
@@ -215,9 +226,9 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
debugProcess.removeDebugProcessListener(this);
}
});
final DebuggerSession session = new DebuggerSession(profile.getName(), debugProcess);
final DebuggerSession session = new DebuggerSession(environment.getSessionName(), debugProcess);
final ExecutionResult executionResult = session.attach(executor, runner, profile, state, remoteConnection, pollConnection);
final ExecutionResult executionResult = session.attach(environment);
if (executionResult == null) {
return null;
}
@@ -225,11 +236,11 @@ public class DebuggerManagerImpl extends DebuggerManagerEx {
getContextManager().setState(DebuggerContextUtil.createDebuggerContext(session, session.getContextManager().getContext().getSuspendContext()), session.getState(), DebuggerSession.EVENT_CONTEXT, null);
final ProcessHandler processHandler = executionResult.getProcessHandler();
synchronized (mySessions) {
mySessions.put(processHandler, session);
}
if (!(processHandler instanceof RemoteDebugProcessHandler)) {
// add listener only to non-remote process handler:
// on Unix systems destroying process does not cause VMDeathEvent to be generated,
@@ -15,9 +15,7 @@
*/
package com.intellij.debugger.impl;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.*;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.engine.*;
import com.intellij.debugger.engine.evaluation.EvaluateException;
@@ -359,22 +357,29 @@ public class DebuggerSession implements AbstractDebuggerSession {
}
@Nullable
protected ExecutionResult attach(@NotNull final Executor executor, @NotNull final ProgramRunner runner, final ModuleRunProfile profile, final RunProfileState state, final RemoteConnection remoteConnection, final boolean pollConnection) throws ExecutionException {
protected ExecutionResult attach(@NotNull final Executor executor,
@NotNull final ProgramRunner runner,
final ModuleRunProfile profile,
final RunProfileState state,
final RemoteConnection remoteConnection,
final boolean pollConnection) throws ExecutionException {
return attach(new DefaultDebugEnvironment(myDebugProcess.getProject(),
executor,
runner,
profile,
state,
null,
remoteConnection,
pollConnection));
}
@Nullable
protected ExecutionResult attach(DebugEnvironment environment) throws ExecutionException {
RemoteConnection remoteConnection = environment.getRemoteConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(remoteConnection);
final String transportName = DebuggerBundle.getTransportName(remoteConnection);
final Module[] modules = profile.getModules();
if (modules.length == 0) {
mySearchScope = GlobalSearchScope.allScope(getProject());
}
else {
GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
for (int idx = 1; idx < modules.length; idx++) {
Module module = modules[idx];
scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
}
mySearchScope = scope;
}
final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(executor, runner, this, state, remoteConnection, pollConnection);
mySearchScope = environment.getSearchScope();
final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(environment, this);
getContextManager().setState(SESSION_EMPTY_CONTEXT, STATE_WAITING_ATTACH, EVENT_START_WAIT_ATTACH, DebuggerBundle.message("status.waiting.attach", addressDisplayName, transportName));
return executionResult;
}
@@ -15,8 +15,10 @@
*/
package com.intellij.debugger.ui;
import com.intellij.debugger.DebugEnvironment;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.DefaultDebugEnvironment;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerContextListener;
@@ -27,9 +29,7 @@ import com.intellij.debugger.ui.tree.render.BatchEvaluator;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionManager;
import com.intellij.execution.Executor;
import com.intellij.execution.configurations.ModuleRunProfile;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.configurations.RemoteState;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.execution.process.ProcessHandler;
@@ -103,10 +103,19 @@ public class DebuggerPanelsManager implements ProjectComponent {
RunContentDescriptor reuseContent,
RemoteConnection remoteConnection,
boolean pollConnection) throws ExecutionException {
return attachVirtualMachine(new DefaultDebugEnvironment(myProject,
executor,
runner,
environment,
state,
reuseContent,
remoteConnection,
pollConnection));
}
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(
executor, runner, (ModuleRunProfile) environment.getRunProfile(), state, remoteConnection, pollConnection
);
@Nullable
public RunContentDescriptor attachVirtualMachine(DebugEnvironment environment) throws ExecutionException {
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(environment);
if (debuggerSession == null) {
return null;
}
@@ -116,16 +125,16 @@ public class DebuggerPanelsManager implements ProjectComponent {
debuggerSession.dispose();
return null;
}
if (state instanceof RemoteState) {
if (environment.isRemote()) {
// optimization: that way BatchEvaluator will not try to lookup the class file in remote VM
// which is an expensive operation when executed first time
debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
}
final DebuggerSessionTab sessionTab = new DebuggerSessionTab(myProject, debuggerSession.getSessionName(), environment.getRunProfile().getIcon());
final DebuggerSessionTab sessionTab = new DebuggerSessionTab(myProject, environment.getSessionName(), environment.getIcon());
Disposer.register(myProject, sessionTab);
RunContentDescriptor runContentDescriptor =
sessionTab.attachToSession(debuggerSession, runner, environment);
RunContentDescriptor runContentDescriptor = sessionTab.attachToSession(debuggerSession, environment);
RunContentDescriptor reuseContent = environment.getReuseContent();
if (reuseContent != null) {
final ProcessHandler prevHandler = reuseContent.getProcessHandler();
if (prevHandler != null) {
@@ -15,6 +15,7 @@
*/
package com.intellij.debugger.ui;
import com.intellij.debugger.DebugEnvironment;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.engine.DebugProcessImpl;
@@ -30,23 +31,20 @@ import com.intellij.debugger.ui.impl.ThreadsPanel;
import com.intellij.debugger.ui.impl.VariablesPanel;
import com.intellij.debugger.ui.impl.WatchDebuggerTree;
import com.intellij.debugger.ui.impl.watch.*;
import com.intellij.execution.*;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.DefaultExecutionResult;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionManager;
import com.intellij.execution.ExecutionResult;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.execution.filters.ExceptionFilters;
import com.intellij.execution.filters.Filter;
import com.intellij.execution.filters.TextConsoleBuilder;
import com.intellij.execution.filters.TextConsoleBuilderFactory;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.runners.RestartAction;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ExecutionConsoleEx;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.actions.CloseAction;
import com.intellij.execution.ui.layout.PlaceInGrid;
import com.intellij.icons.AllIcons;
import com.intellij.ide.actions.ContextHelpAction;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
@@ -80,14 +78,12 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
private final VariablesPanel myVariablesPanel;
private final MainWatchPanel myWatchPanel;
private ProgramRunner myRunner;
private volatile DebuggerSession myDebuggerSession;
private final MyDebuggerStateManager myStateManager = new MyDebuggerStateManager();
private final FramesPanel myFramesPanel;
private ExecutionEnvironment myEnvironment;
private RunProfile myConfiguration;
private DebugEnvironment myEnvironment;
private final ThreadsPanel myThreadsPanel;
private static final String THREAD_DUMP_CONTENT_PREFIX = "Dump";
@@ -184,7 +180,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
myUi.addContent(threadsContent, 0, PlaceInGrid.left, true);
for (Content each : myUi.getContents()) {
updateStatus(each);
updateStatus(each);
}
myUi.addListener(new ContentManagerAdapter() {
@@ -230,13 +226,15 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
myUi.removeContent(myUi.findContent(DebuggerContentInfo.CONSOLE_CONTENT), true);
Content console;
Content console = null;
if (myConsole instanceof ExecutionConsoleEx) {
((ExecutionConsoleEx)myConsole).buildUi(myUi);
console = myUi.findContent(DebuggerContentInfo.CONSOLE_CONTENT);
LOG.assertTrue(console != null, "Console content was not created");
if (console == null) {
LOG.debug("Reuse console created with non-debug runner");
}
}
else {
if (console == null) {
console = myUi.createContent(DebuggerContentInfo.CONSOLE_CONTENT, myConsole.getComponent(),
XDebuggerBundle.message("debugger.session.tab.console.content.name"),
XDebuggerUIConstants.CONSOLE_TAB_ICON, myConsole.getPreferredFocusableComponent());
@@ -259,15 +257,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
}
console.setActions(consoleActions, ActionPlaces.DEBUGGER_TOOLBAR, myConsole.getPreferredFocusableComponent());
initLogConsoles(myConfiguration, myRunContentDescriptor.getProcessHandler(), myConsole);
DefaultActionGroup group = new DefaultActionGroup();
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
RestartAction restarAction = new RestartAction(executor,
myRunner, myRunContentDescriptor.getProcessHandler(), XDebuggerUIConstants.DEBUG_AGAIN_ICON,
myRunContentDescriptor, myEnvironment);
group.add(restarAction);
restarAction.registerShortcut(myUi.getComponent());
if (executionResult instanceof DefaultExecutionResult) {
final AnAction[] actions = ((DefaultExecutionResult)executionResult).getRestartActions();
@@ -331,12 +321,11 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
group.addSeparator();
addActionToGroup(group, PinToolwindowTabAction.ACTION_NAME);
group.add(new CloseAction(executor, myRunContentDescriptor, getProject()));
group.add(new ContextHelpAction(executor.getHelpId()));
myEnvironment.initContent(myRunContentDescriptor, getLogManager(), group);
myUi.getOptions().setLeftToolbar(group, ActionPlaces.DEBUGGER_TOOLBAR);
return myRunContentDescriptor;
}
@@ -384,7 +373,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
}
public String getSessionName() {
return myConfiguration.getName();
return myEnvironment.getSessionName();
}
public DebuggerStateManager getContextManager() {
@@ -427,15 +416,10 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
}
}
public RunContentDescriptor attachToSession(final DebuggerSession session, final ProgramRunner runner, final ExecutionEnvironment env)
throws ExecutionException {
public RunContentDescriptor attachToSession(final DebuggerSession session, DebugEnvironment environment) throws ExecutionException {
disposeSession();
myDebuggerSession = session;
myRunner = runner;
myEnvironment = env;
myConfiguration = env.getRunProfile();
registerFileMatcher(myConfiguration);
myEnvironment = environment;
session.getContextManager().addListener(new DebuggerContextListener() {
public void changeEvent(DebuggerContextImpl newContext, int event) {
@@ -109,6 +109,10 @@ public abstract class DebuggerSessionTabBase implements DebuggerLogConsoleManage
}
}
protected LogFilesManager getLogManager() {
return myManager;
}
// TODO[oleg]: talk to nick
public void setEnvironment(@NotNull final ExecutionEnvironment env) {
myEnvironment = env;