void (@NotNull Task task) { if (isSynchronousHeadless(task)) { if (SwingUtilities.isEventDispatchThread()) { runProcessWithProgressSynchronously(task); } else { runProcessWithProgressInCurrentThread(task, new EmptyProgressIndicator(), ModalityState.defaultModalityState()); } } else if (task.isModal()) { runProcessWithProgressSynchronously(task.asModal()); } else { Task.Backgroundable backgroundable = task.asBackgroundable(); if (isSynchronous(backgroundable)) { runProcessWithProgressSynchronously(backgroundable); } else { runAsynchronously(backgroundable); } } }