diff --git a/python/src/com/jetbrains/python/console/PythonConsoleView.java b/python/src/com/jetbrains/python/console/PythonConsoleView.java index 86e229d84574..2cafcee76f66 100644 --- a/python/src/com/jetbrains/python/console/PythonConsoleView.java +++ b/python/src/com/jetbrains/python/console/PythonConsoleView.java @@ -182,30 +182,32 @@ public class PythonConsoleView extends LanguageConsoleImpl implements Observable @Override public void executeCode(final @NotNull String code, @Nullable final Editor editor) { - myInitialized.doWhenDone(() -> - ProgressManager.getInstance().run(new Task.Backgroundable(null, "Executing Code in Console...", false) { - @Override - public void run(@NotNull final ProgressIndicator indicator) { - long time = System.currentTimeMillis(); - while (!myExecuteActionHandler.isEnabled() || !myExecuteActionHandler.canExecuteNow()) { - if (indicator.isCanceled()) { - break; - } - if (System.currentTimeMillis() - time > 1000) { - if (editor != null) { - UIUtil.invokeLaterIfNeeded( - () -> HintManager.getInstance() - .showErrorHint(editor, myExecuteActionHandler.getCantExecuteMessage())); - } - return; - } - TimeoutUtil.sleep(300); - } - if (!indicator.isCanceled()) { - executeInConsole(code); - } - } - })); + myInitialized.doWhenDone( + () -> + ProgressManager.getInstance().run(new Task.Backgroundable(null, "Executing Code in Console...", false) { + @Override + public void run(@NotNull final ProgressIndicator indicator) { + long time = System.currentTimeMillis(); + while (!myExecuteActionHandler.isEnabled() || !myExecuteActionHandler.canExecuteNow()) { + if (indicator.isCanceled()) { + break; + } + if (System.currentTimeMillis() - time > 1000) { + if (editor != null) { + UIUtil.invokeLaterIfNeeded( + () -> HintManager.getInstance() + .showErrorHint(editor, myExecuteActionHandler.getCantExecuteMessage())); + } + return; + } + TimeoutUtil.sleep(300); + } + if (!indicator.isCanceled()) { + executeInConsole(code); + } + } + }) + ); }