void (final @NotNull AnActionEvent event) { EditorWindow window = event.getData(EditorWindow.DATA_KEY); VirtualFile selectedFile = window != null ? window.getSelectedFile() : null; boolean enabled = isEnabled(selectedFile, window); event.getPresentation().setEnabledAndVisible(enabled); }