void (@NotNull SequentialTask task) { Application application = ApplicationManager.getApplication(); FormattingProgressCallback progressTask = myProgressTask.getAndSet(null); if (progressTask == null || !application.isDispatchThread() || application.isUnitTestMode()) { task.prepare(); while (!task.isDone()) { task.iteration(); } } else { progressTask.setTask(task); if (progressTask instanceof SequentialModalProgressTask) { ProgressManager.getInstance().run((SequentialModalProgressTask)progressTask); } } }