BatchExecutionResult (@NotNull ActionContext context, ModChooseAction chooser) { ModCommandAction action = StreamEx.of(chooser.actions()).filter(act -> act.getPresentation(context) != null) .findFirst().orElse(null); if (action == null) return Result.NOTHING; String name = chooser.title(); ModCommand next = ProgressManager.getInstance().runProcessWithProgressSynchronously( () -> ReadAction.nonBlocking(() -> { if (action.getPresentation(context) == null) return null; return action.perform(context); }).executeSynchronously(), name, true, context.project()); if (next == null) return Result.ABORT; return executeInBatch(context, next); }