void (boolean requestEditorFocus) { ProgressManager.getInstance().run(new Task.Backgroundable(myProject, PyBundle.message("connecting.to.console.title"), false) { @Override public void run(@NotNull final ProgressIndicator indicator) { try { Sdk sdk = mySdk; if (sdk == null) { throw new ExecutionException(PyBundle.message("pydev.console.python.interpreter.is.not.selected")); } initAndRun(sdk); indicator.setText(PyBundle.message("connecting.to.console.progress")); connect(getStatementsToExecute()); if (requestEditorFocus) { myConsoleView.requestFocus(); } } catch (ExecutionException e) { LOG.warn("Error running console", e); ApplicationManager.getApplication().invokeLater(() -> showErrorsInConsole(e)); } } }); }