diff options
Diffstat (limited to 'python/src/com/jetbrains/python/debugger/PyDebugProcess.java')
-rw-r--r-- | python/src/com/jetbrains/python/debugger/PyDebugProcess.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/python/src/com/jetbrains/python/debugger/PyDebugProcess.java b/python/src/com/jetbrains/python/debugger/PyDebugProcess.java index cff49fb1f0d8..cdea41298a4e 100644 --- a/python/src/com/jetbrains/python/debugger/PyDebugProcess.java +++ b/python/src/com/jetbrains/python/debugger/PyDebugProcess.java @@ -17,6 +17,7 @@ package com.jetbrains.python.debugger; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.intellij.execution.console.DuplexConsoleView; import com.intellij.execution.process.ProcessEvent; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.process.ProcessListener; @@ -35,6 +36,7 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.remote.RemoteProcessHandlerBase; +import com.intellij.util.ui.UIUtil; import com.intellij.xdebugger.*; import com.intellij.xdebugger.breakpoints.XBreakpoint; import com.intellij.xdebugger.breakpoints.XBreakpointHandler; @@ -43,6 +45,7 @@ import com.intellij.xdebugger.breakpoints.XLineBreakpoint; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; import com.intellij.xdebugger.frame.XValueChildrenList; import com.intellij.xdebugger.stepping.XSmartStepIntoHandler; +import com.jetbrains.python.console.PythonDebugLanguageConsoleView; import com.jetbrains.python.console.pydev.PydevCompletionVariant; import com.jetbrains.python.debugger.pydev.*; import com.jetbrains.python.run.PythonProcessHandler; @@ -84,6 +87,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr private final XSmartStepIntoHandler<?> mySmartStepIntoHandler; private boolean myWaitingForConnection = false; private PyStackFrame myStackFrameBeforeResume; + private PyStackFrame myConsoleContextFrame = null; public PyDebugProcess(final @NotNull XDebugSession session, @NotNull final ServerSocket serverSocket, @@ -285,6 +289,19 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr PySignatureCacheManager.getInstance(getSession().getProject()).recordSignature(myPositionConverter.convertSignature(signature)); } + @Override + public void showConsole(PyThreadInfo thread) { + myConsoleContextFrame = new PyExecutionStack(this, thread).getTopFrame(); + if (myExecutionConsole instanceof PythonDebugLanguageConsoleView) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + ((PythonDebugLanguageConsoleView)myExecutionConsole).enableConsole(false); + } + }); + } + } + protected void afterConnect() { } @@ -545,6 +562,11 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr } final PyStackFrame frame = (PyStackFrame)getSession().getCurrentStackFrame(); + + if (frame == null && myConsoleContextFrame != null) { + return myConsoleContextFrame; + } + if (frame == null) { throw new PyDebuggerException("Process is running"); } |