void (@NotNull AnActionEvent e) { final EditorWindow window = getEditorWindow(e); if (window != null) { e.getPresentation().setEnabledAndVisible(window.hasClosedTabs()); return; } Project project = e.getProject(); if (project != null && !EditorHistoryManager.getInstance(project).getFileList().isEmpty()) { e.getPresentation().setEnabledAndVisible(true); return; } e.getPresentation().setEnabledAndVisible(false); }