void (@Nullable String code) { if (code != null) { if (PyConsoleUtil.isCommandQueueEnabled(getProject())) { executeInConsole(code); } else { ProgressManager.getInstance().run(new Task.Backgroundable(null, PyBundle.message("console.executing.code.in.console"), true) { @Override public void run(@NotNull final ProgressIndicator indicator) { while (!myExecuteActionHandler.isEnabled() || !myExecuteActionHandler.canExecuteNow()) { if (indicator.isCanceled()) { break; } TimeoutUtil.sleep(300); } if (!indicator.isCanceled()) { executeInConsole(code); } } }); } } else { requestFocus(); } }