void ( @NotNull Project project, @NotNull @Nls String title, @NotNull ProgressExecutionMode progressExecutionMode, @NotNull ExternalSystemTaskUnderProgress task ) { switch (progressExecutionMode) { case NO_PROGRESS_SYNC -> task.execute(new EmptyProgressIndicator()); case MODAL_SYNC -> new Task.Modal(project, title, true) { @Override public @Nullable Object getId() { return task.getId(); } @Override public void run(@NotNull ProgressIndicator indicator) { task.execute(indicator); } }.queue(); case NO_PROGRESS_ASYNC -> ApplicationManager.getApplication().executeOnPooledThread( () -> task.execute(new EmptyProgressIndicator()) ); case IN_BACKGROUND_ASYNC -> new Task.Backgroundable(project, title) { @Override public @Nullable Object getId() { return task.getId(); } @Override public void run(@NotNull ProgressIndicator indicator) { task.execute(indicator); } }.queue(); case START_IN_FOREGROUND_ASYNC -> new Task.Backgroundable(project, title, true, PerformInBackgroundOption.DEAF) { @Override public @Nullable Object getId() { return task.getId(); } @Override public void run(@NotNull ProgressIndicator indicator) { task.execute(indicator); } }.queue(); } }