void (@NotNull AnActionEvent e) { DataContext dataContext = e.getDataContext(); IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); if (view == null) return; PsiDirectory dir = getTargetDirectory(dataContext, view); if (dir == null) return; Project project = dir.getProject(); FileTemplate selectedTemplate = getTemplate(project, dir); if (selectedTemplate != null) { AnAction action = getReplacedAction(selectedTemplate); if (action != null) { action.actionPerformed(e); } else { FileTemplateManager.getInstance(project).addRecentName(selectedTemplate.getName()); AttributesDefaults defaults = getAttributesDefaults(dataContext); Properties properties = defaults != null ? defaults.getDefaultProperties() : null; CreateFromTemplateDialog dialog = new CreateFromTemplateDialog(project, dir, selectedTemplate, defaults, properties); PsiElement createdElement = dialog.create(); if (createdElement != null) { elementCreated(dialog, createdElement); view.selectElement(createdElement); if (selectedTemplate.isLiveTemplateEnabled() && createdElement instanceof PsiFile) { Map<String, String> defaultValues = getLiveTemplateDefaults(dataContext, ((PsiFile)createdElement)); startLiveTemplate((PsiFile)createdElement, notNull(defaultValues, Collections.emptyMap())); } } } } }