From 923c1f819ef7dfe5d4e3daeb777a58873c64d701 Mon Sep 17 00:00:00 2001 From: Liana Bakradze Date: Thu, 14 Apr 2016 17:24:57 +0300 Subject: [PATCH] EDU-588 Add ability to turn off interactive console --- .../python/edu/debugger/PyEduDebugRunner.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduDebugRunner.java b/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduDebugRunner.java index 195117796bad..596eb4e2325b 100644 --- a/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduDebugRunner.java +++ b/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduDebugRunner.java @@ -152,6 +152,22 @@ public class PyEduDebugRunner extends PyDebugRunner { eduConsole.setCloseable(false); ui.addContent(eduConsole, 0, PlaceInGrid.right, false); + Presentation presentation = view.getSwitchConsoleActionPresentation(); + ToggleAction action = new ToggleAction(presentation.getText(), presentation.getDescription(), presentation.getIcon()) { + + @Override + public boolean isSelected(AnActionEvent e) { + return !view.isPrimaryConsoleEnabled(); + } + + @Override + public void setSelected(AnActionEvent e, boolean state) { + view.enableConsole(!state); + } + }; + + eduConsole.setActions(new DefaultActionGroup(action), ActionPlaces.DEBUGGER_TOOLBAR, + view.getPreferredFocusableComponent()); PyDebugProcess process = (PyDebugProcess)session.getDebugProcess(); PyDebugRunner.initDebugConsoleView(project, process, view, processHandler, session);