void (@NotNull Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) { builder .setTitle(GroovyBundle.message("new.class.dialog.title")) .addKind(GroovyBundle.message("new.class.list.item.class"), JetgroovyIcons.Groovy.Class, GroovyTemplates.GROOVY_CLASS) .addKind(GroovyBundle.message("new.class.list.item.interface"), JetgroovyIcons.Groovy.Interface, GroovyTemplates.GROOVY_INTERFACE); if (GroovyConfigUtils.getInstance().isVersionAtLeast(directory, GroovyConfigUtils.GROOVY2_3, true)) { builder.addKind(GroovyBundle.message("new.class.list.item.trait"), JetgroovyIcons.Groovy.Trait, GroovyTemplates.GROOVY_TRAIT); } builder .addKind(GroovyBundle.message("new.class.list.item.enum"), JetgroovyIcons.Groovy.Enum, GroovyTemplates.GROOVY_ENUM) .addKind(GroovyBundle.message("new.class.list.item.annotation"), JetgroovyIcons.Groovy.AnnotationType, GroovyTemplates.GROOVY_ANNOTATION); if (GroovyConfigUtils.isAtLeastGroovy40(directory)) { builder.addKind(GroovyBundle.message("new.class.list.item.record"), JetgroovyIcons.Groovy.Record, GroovyTemplates.GROOVY_RECORD); } for (FileTemplate template : FileTemplateManager.getInstance(project).getAllTemplates()) { FileType fileType = FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(template.getExtension()); if (fileType.equals(GroovyFileType.GROOVY_FILE_TYPE) && JavaDirectoryService.getInstance().getPackage(directory) != null) { builder.addKind(template.getName(), JetgroovyIcons.Groovy.Class, template.getName()); } } builder.setValidator(new InputValidatorEx() { @Override public String getErrorText(String inputString) { return GroovyBundle.message("invalid.qualified.name"); } @Override public boolean checkInput(String inputString) { return true; } @Override public boolean canClose(String inputString) { return !StringUtil.isEmptyOrSpaces(inputString) && PsiNameHelper.getInstance(project).isQualifiedName(inputString); } }); }