boolean (AnActionEvent e, @NotNull FileTemplate template) { if (e == null) return false; DataContext dataContext = e.getDataContext(); IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); if (view == null) return false; PsiDirectory[] dirs = view.getDirectories(); if (dirs.length == 0) return false; return FileTemplateUtil.canCreateFromTemplate(dirs, template); }