void (VirtualFile root) { if (!root.isDirectory()) return; final PsiManager psiManager = PsiManager.getInstance(myModule.getProject()); final PsiDirectory psiRoot = psiManager.findDirectory(root); if (psiRoot == null) return; PsiDirectory descrRoot = StreamEx.of(psiRoot.getSubdirectories()).findFirst(dir -> getDescriptionFolderName().equals(dir.getName())).orElse(null); try { descrRoot = descrRoot == null ? psiRoot.createSubdirectory(getDescriptionFolderName()) : descrRoot; if (isFixedDescriptionFilename()) { PsiDirectory dir = descrRoot.findSubdirectory(myFilename); if (dir == null) { descrRoot = descrRoot.createSubdirectory(myFilename); } } final FileTemplate descrTemplate = FileTemplateManager.getInstance(myModule.getProject()).getJ2eeTemplate(TEMPLATE_NAME); final PsiElement template = FileTemplateUtil.createFromTemplate(descrTemplate, getNewFileName(), null, descrRoot); if (template instanceof PsiFile) { final VirtualFile file = ((PsiFile)template).getVirtualFile(); if (file != null) { FileEditorManager.getInstance(myModule.getProject()).openFile(file, true); } } } catch (Exception e) {// } }