if (treePathEnd != null &&
treePathEnd instanceof DirectoryTextTemplateTreeItem) {
DirectoryTextTemplateTreeItem treeItem = (DirectoryTextTemplateTreeItem) treePathEnd;
DirectoryTextTemplate dir = (DirectoryTextTemplate) DirectoryLocator.getDirectory(DirectoryTextTemplate.class, false);
TextTemplateDetails details = new TextTemplateDetails();
details.title = template;
details.groupId = treeItem.getID();
DirectoryTextTemplateItem newItem = new DirectoryTextTemplateItem(details);
dir.getItems().append(newItem);