void (final @NotNull AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand( project, () -> { EditorWindow window = e.getData(EditorWindow.DATA_KEY); if (window != null){ for (VirtualFile file : window.getFileList()) { window.closeFile(file); } return; } FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project); VirtualFile selectedFile = fileEditorManager.getSelectedFiles()[0]; for (VirtualFile openFile : fileEditorManager.getSiblings(selectedFile)) { fileEditorManager.closeFile(openFile); } }, IdeBundle.message("command.close.all.editors"), null ); }