diff --git a/python/src/com/jetbrains/python/console/PythonDebugConsoleView.java b/python/src/com/jetbrains/python/console/PythonDebugConsoleView.java index c3b413d9ff56..5193c864c7c4 100644 --- a/python/src/com/jetbrains/python/console/PythonDebugConsoleView.java +++ b/python/src/com/jetbrains/python/console/PythonDebugConsoleView.java @@ -6,6 +6,7 @@ import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.project.Project; +import com.intellij.openapi.wm.IdeFocusManager; import com.jetbrains.python.PythonLanguage; import com.jetbrains.python.console.pydev.ConsoleCommunication; import org.jetbrains.annotations.NotNull; @@ -24,6 +25,10 @@ public class PythonDebugConsoleView extends LanguageConsoleViewImpl { getPythonLanguageConsole().setConsoleCommunication(communication); } + public void requestFocus() { + IdeFocusManager.findInstance().requestFocus(getPythonLanguageConsole().getConsoleEditor().getContentComponent(), true); + } + private PythonLanguageConsole getPythonLanguageConsole() { return ((PythonLanguageConsole)myConsole); } @@ -49,7 +54,6 @@ public class PythonDebugConsoleView extends LanguageConsoleViewImpl { protected void appendToHistoryDocument(@NotNull Document history, @NotNull String text) { myPythonDebugConsoleView.beforeExternalAddContentToDocument(text.length(), ConsoleViewContentType.NORMAL_OUTPUT); super.appendToHistoryDocument(history, text); - } } diff --git a/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java b/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java index b522c671afe0..3802fecf13e3 100644 --- a/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java +++ b/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java @@ -69,6 +69,7 @@ public class PythonDebugLanguageConsoleView extends JPanel implements ConsoleVie public void showDebugConsole(boolean flag) { if (flag) { doShowConsole(PYDEV_CONSOLE_PANEL); + myPydevConsoleView.requestFocus(); } else { doShowConsole(TEXT_CONSOLE_PANEL);