void (@NotNull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand( project, () -> { List<Pair<EditorComposite, EditorWindow>> filesToClose = getFilesToClose(e); for (int i = 0; i != filesToClose.size(); ++i) { final Pair<EditorComposite, EditorWindow> we = filesToClose.get(i); we.getSecond().closeFile(we.getFirst().getFile()); } }, IdeBundle.message("command.close.all.unmodified.editors"), null ); }