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