void () { ProgressManager.getInstance().run(new Task.Modal(null, "", true) { @Override public void run(@NotNull ProgressIndicator indicator) { new ProgressIndicatorBase().addStateDelegate((ProgressIndicatorEx)indicator); // this makes ProgressWindows#isRunning() false, thus it stops messages processing // to make it fail more predictably TimeoutUtil.sleep(50); // deadlocks, because ProgressWindow is no longer processing the message pump ApplicationManager.getApplication().invokeAndWait(() -> { }); } }); }