EDU-652 Debug input functions doesn't work for PyCharm Edu
[idea/community.git] / python / educational-python / src / com / jetbrains / python / edu / debugger / PyEduDebugProcess.java
index fd0c6f2f38e9982ba3124d0755c69e39d2b2c313..b206944722876c0c9c2d4a910d17775507c3982b 100644 (file)
@@ -4,9 +4,16 @@ import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import com.intellij.execution.process.ProcessHandler;
 import com.intellij.execution.ui.ExecutionConsole;
+import com.intellij.execution.ui.RunnerLayoutUi;
+import com.intellij.execution.ui.layout.PlaceInGrid;
+import com.intellij.icons.AllIcons;
 import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.ui.content.Content;
 import com.intellij.xdebugger.XDebugSession;
+import com.intellij.xdebugger.XDebuggerBundle;
+import com.intellij.xdebugger.ui.XDebugTabLayouter;
 import com.jetbrains.python.PythonHelpersLocator;
+import com.jetbrains.python.console.PythonDebugLanguageConsoleView;
 import com.jetbrains.python.debugger.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -66,4 +73,27 @@ class PyEduDebugProcess extends PyDebugProcess {
     });
     return !filteredFrames.isEmpty() ? filteredFrames : frames;
   }
+
+  @NotNull
+  @Override
+  public XDebugTabLayouter createTabLayouter() {
+    return new XDebugTabLayouter() {
+      @NotNull
+      @Override
+      public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) {
+        final PythonDebugLanguageConsoleView view = ((PythonDebugLanguageConsoleView)console);
+        view.enableConsole(false);
+
+        Content eduConsole =
+          ui.createContent("EduConsole", view.getComponent(),
+                           XDebuggerBundle.message("debugger.session.tab.console.content.name"),
+                           AllIcons.Debugger.ToolConsole, view.getPreferredFocusableComponent());
+        eduConsole.setCloseable(false);
+        ui.addContent(eduConsole, 0, PlaceInGrid.right, false);
+        return eduConsole;
+      }
+    };
+  }
+
+
 }