boolean (@NotNull Task task) { if (LOG.isDebugEnabled()) LOG.debug("CoreProgressManager#runProcessWithProgressSynchronously, " + task, new Throwable()); Ref<Throwable> exceptionRef = new Ref<>(); Runnable taskContainer = () -> { try { startTask(task, getProgressIndicator(), null); } catch (ProcessCanceledException e) { throw e; } catch (Throwable e) { exceptionRef.set(e); } }; ApplicationEx application = ApplicationManagerEx.getApplicationEx(); boolean result = application.runProcessWithProgressSynchronously(taskContainer, task.getTitle(), task.isCancellable(), shouldEnterModalityState(task), task.getProject(), task.getParentComponent(), task.getCancelText()); ApplicationUtil.invokeAndWaitSomewhere(task.whereToRunCallbacks(), application.getDefaultModalityState(), () -> finishTask(task, !result, exceptionRef.get())); return result; }