void (@NotNull FileChooserPanel panel, @NotNull AnActionEvent e) { var directory = panel.currentDirectory(); e.getPresentation().setEnabled(directory != null && !directory.getFileSystem().isReadOnly()); }