com.intellij.ide.fileTemplates.FileTemplate Java Examples

The following examples show how to use com.intellij.ide.fileTemplates.FileTemplate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private static FileTemplate getTemplateFromManager(@Nonnull final String templateName, @Nonnull final FTManager ftManager) {
  FileTemplateBase template = ftManager.getTemplate(templateName);
  if (template != null) {
    return template;
  }
  template = ftManager.findTemplateByName(templateName);
  if (template != null) {
    return template;
  }
  if (templateName.endsWith("ForTest") && ApplicationManager.getApplication().isUnitTestMode()) {
    return null;
  }

  String message = "Template not found: " + templateName/*ftManager.templateNotFoundMessage(templateName)*/;
  LOG.error(message);
  return null;
}
 
Example #2
Source File: CreateFromTemplateGroup.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
public void update(@Nonnull AnActionEvent event) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  Presentation presentation = event.getPresentation();
  if(project != null && !project.isDisposed()) {
    FileTemplate[] allTemplates = FileTemplateManager.getInstance(project).getAllTemplates();
    for (FileTemplate template : allTemplates) {
      if (canCreateFromTemplate(event, template)) {
        presentation.setEnabled(true);
        return;
      }
    }
  }
  presentation.setEnabled(false);
}
 
Example #3
Source File: MuleMavenProjectBuilderHelper.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
private VirtualFile createLog4JTest(final Project project, final MavenId projectId, final VirtualFile appDirectory)
{
    return new WriteCommandAction<VirtualFile>(project, "Create Log4J Test File", PsiFile.EMPTY_ARRAY)
    {
        @Override
        protected void run(@NotNull Result<VirtualFile> result) throws Throwable
        {

            try
            {
                VirtualFile configFile = appDirectory.findOrCreateChildData(this, "log4j2-test.xml");
                final FileTemplateManager manager = FileTemplateManager.getInstance(project);
                final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.LOG4J2_TEST);
                final Properties defaultProperties = manager.getDefaultProperties();
                final String text = template.getText(defaultProperties);
                VfsUtil.saveText(configFile, text);
                result.setResult(configFile);
            }
            catch (IOException e)
            {
                showError(project, e);
            }
        }
    }.execute().getResultObject();
}
 
Example #4
Source File: CSharpCreateFileAction.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Override
@RequiredReadAction
protected PsiFile createFile(String name, String templateName, final PsiDirectory dir)
{
	FileTemplate template = FileTemplateManager.getInstance(dir.getProject()).getInternalTemplate(templateName);
	try
	{
		Map<String, Object> map = new HashMap<>();
		map.put("psiDirectory", dir);

		return (PsiFile) FileTemplateUtil.createFromTemplate(template, name, map, dir, getClass().getClassLoader());
	}
	catch(Exception e)
	{
		LOG.error(e);
		return null;
	}
}
 
Example #5
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nonnull
public FileTemplate getDefaultTemplate(@Nonnull final String name) {
  final String templateQName = myTypeManager.getExtension(name).isEmpty() ? FileTemplateBase.getQualifiedName(name, "java") : name;

  for (FTManager manager : getAllManagers()) {
    final FileTemplateBase template = manager.getTemplate(templateQName);
    if (template instanceof BundledFileTemplate) {
      final BundledFileTemplate copy = ((BundledFileTemplate)template).clone();
      copy.revertToDefaults();
      return copy;
    }
  }

  String message = "Default template not found: " + name;
  LOG.error(message);
  return null;
}
 
Example #6
Source File: FileTemplateTabAsList.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void customizeCellRenderer(@Nonnull JList<? extends FileTemplate> list, FileTemplate value, int index, boolean selected, boolean hasFocus) {
  Image icon;
  icon = FileTemplateUtil.getIcon(value);
  final boolean internalTemplate = AllFileTemplatesConfigurable.isInternalTemplate(value.getName(), getTitle());
  if (internalTemplate) {
    setFont(getFont().deriveFont(Font.BOLD));
    append(value.getName());
  }
  else {
    setFont(getFont().deriveFont(Font.PLAIN));
    append(value.getName());
  }

  if (!value.isDefault()) {
    if (!selected) {
      setForeground(MODIFIED_FOREGROUND);
    }
  }
  setIcon(icon);
}
 
Example #7
Source File: WeexTemplateFactory.java    From weex-language-support with MIT License 6 votes vote down vote up
public static PsiFile createFromTemplate(final PsiDirectory directory, final String name,
                                         String fileName, String templateName,
                                         @NonNls String... parameters) throws IncorrectOperationException {

    final FileTemplate template = FileTemplateManager.getInstance(directory.getProject()).getInternalTemplate(templateName);
    String text;

    try {
        text = template.getText();
    } catch (Exception e) {
        throw new RuntimeException("Unable to load template for " +
                FileTemplateManager.getInstance().internalTemplateToSubject(templateName), e);
    }

    final PsiFileFactory factory = PsiFileFactory.getInstance(directory.getProject());

    final PsiFile file = factory.createFileFromText(fileName, WeexFileType.INSTANCE, text);
    CodeStyleManager.getInstance(directory.getProject()).reformat(file);
    return (PsiFile) directory.add(file);
}
 
Example #8
Source File: FileTemplateHelper.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
private static FileTemplate getProjectTemplatePriority(String name, FileTemplateManager projectManager, FileTemplateManager defaultManager) {
    FileTemplate result;

    // Project
    result = getProjectTemplateOnly(name, projectManager, defaultManager);
    if (result != null) {
        return result;
    }

    // Default
    result = getDefaultTemplateOnly(name, projectManager, defaultManager);
    if (result != null) {
        return result;
    }

    return null;
}
 
Example #9
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public FileTemplate getInternalTemplate(@Nonnull @NonNls String templateName) {
  FileTemplateBase template = (FileTemplateBase)findInternalTemplate(templateName);

  if (template == null) {
    template = (FileTemplateBase)getJ2eeTemplate(templateName); // Hack to be able to register class templates from the plugin.
    if (template != null) {
      template.setReformatCode(true);
    }
    else {
      final String text = normalizeText(getDefaultClassTemplateText(templateName));
      template = getSettings().getInternalTemplatesManager().addTemplate(templateName, "java");
      template.setText(text);
    }
  }
  return template;
}
 
Example #10
Source File: FileTemplateTabAsTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void selectTemplate(FileTemplate template) {
  String name = template.getName();
  if (template.getExtension().length() > 0) {
    name += "." + template.getExtension();
  }

  final FileTemplateNode node = (FileTemplateNode)TreeUtil.findNodeWithObject(myRoot, name);
  if (node != null) {
    TreeUtil.selectNode(myTree, node);
    onTemplateSelected(); // this is important because we select different Template for the same node
  }
}
 
Example #11
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void validateRecentNames() {
  final Collection<FileTemplateBase> allTemplates = getSettings().getDefaultTemplatesManager().getAllTemplates(false);
  final List<String> allNames = new ArrayList<>(allTemplates.size());
  for (FileTemplate fileTemplate : allTemplates) {
    allNames.add(fileTemplate.getName());
  }
  myState.validateNames(allNames);
}
 
Example #12
Source File: CreateFromTemplateGroup.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static AnAction replaceAction(final FileTemplate template) {
  for (CreateFromTemplateActionReplacer actionFactory : CreateFromTemplateActionReplacer.CREATE_FROM_TEMPLATE_REPLACER.getExtensionList()) {
    AnAction action = actionFactory.replaceCreateFromFileTemplateAction(template);
    if (action != null) {
      return action;
    }
  }
  return null;
}
 
Example #13
Source File: CreateFromTemplateActionBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public final void actionPerformed(@Nonnull AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  IdeView view = dataContext.getData(LangDataKeys.IDE_VIEW);
  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);
      Map<String, Object> properties = defaults != null ? defaults.getDefaultProperties() : null;
      CreateFromTemplateDialog dialog = new CreateFromTemplateDialog(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()));
        }
      }
    }
  }
}
 
Example #14
Source File: FileReferenceQuickFixProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void openFile(@Nonnull Project project, PsiDirectory directory, PsiFile newFile, String text) {
  super.openFile(project, directory, newFile, text);
  if (!isDirectory && myNewFileTemplateName != null) {
    FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance(project);
    FileTemplate template = findTemplate(fileTemplateManager);

    if (template != null && template.isLiveTemplateEnabled()) {
      CreateFromTemplateActionBase.startLiveTemplate(newFile);
    }
  }
}
 
Example #15
Source File: MuleDomainMavenProjectBuilderHelper.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
private VirtualFile createMuleConfigFile(final Project project, final MavenId projectId, final VirtualFile appDirectory)
{
    //final String domainConfigName = projectId.getArtifactId();
    final String domainConfigName = "mule-domain-config"; //Currently Mule requires it to be mule-domain-config.xml

    return new WriteCommandAction<VirtualFile>(project, "Create Mule Domain Config File", PsiFile.EMPTY_ARRAY)
    {
        @Override
        protected void run(@NotNull Result<VirtualFile> result) throws Throwable
        {

            try
            {
                VirtualFile configFile = appDirectory.findOrCreateChildData(this, domainConfigName + ".xml");
                final Properties templateProps = new Properties();
                templateProps.setProperty("NAME", projectId.getArtifactId());
                final FileTemplateManager manager = FileTemplateManager.getInstance(project);
                final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_DOMAIN_CONFIGURATION_FILE);
                final Properties defaultProperties = manager.getDefaultProperties();
                defaultProperties.putAll(templateProps);
                final String text = template.getText(defaultProperties);
                VfsUtil.saveText(configFile, text);
                result.setResult(configFile);
            }
            catch (IOException e)
            {
                showError(project, e);
            }
        }
    }.execute().getResultObject();
}
 
Example #16
Source File: CreateClassAction.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
  builder.setTitle(IdeBundle.message("action.create.new.class"));
  for (FileTemplate fileTemplate : HaxeFileTemplateUtil.getApplicableTemplates()) {
    final String templateName = fileTemplate.getName();
    final String shortName = HaxeFileTemplateUtil.getTemplateShortName(templateName);
    final Icon icon = HaxeFileTemplateUtil.getTemplateIcon(templateName);
    builder.addKind(shortName, icon, templateName);
  }
}
 
Example #17
Source File: CreateNMMLFileAction.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
  builder.setTitle(HaxeBundle.message("create.nmml.file.action"));
  for (FileTemplate fileTemplate : HaxeFileTemplateUtil.getNMMLTemplates()) {
    final String templateName = fileTemplate.getName();
    final String shortName = HaxeFileTemplateUtil.getTemplateShortName(templateName);
    builder.addKind(shortName, icons.HaxeIcons.Nmml_16, templateName);
  }
}
 
Example #18
Source File: HaxeFileTemplateUtil.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public static PsiElement createClass(String className, String packageName, PsiDirectory directory, String templateName, @org.jetbrains.annotations.Nullable java.lang.ClassLoader classLoader)
  throws Exception {
  final Properties props = new Properties(FileTemplateManager.getInstance().getDefaultProperties(directory.getProject()));
  props.setProperty(FileTemplate.ATTRIBUTE_NAME, className);
  props.setProperty(FileTemplate.ATTRIBUTE_PACKAGE_NAME, packageName);

  final FileTemplate template = FileTemplateManager.getInstance().getInternalTemplate(templateName);

  return FileTemplateUtil.createFromTemplate(template, className, props, directory, classLoader);
}
 
Example #19
Source File: CreateFromTemplatePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public JComponent getComponent() {
  if (myMainPanel == null) {
    myMainPanel = new JPanel(new GridBagLayout()) {
      @Override
      public Dimension getPreferredSize() {
        return getMainPanelPreferredSize(super.getPreferredSize());
      }
    };
    myAttrPanel = new JPanel(new GridBagLayout());
    JPanel myScrollPanel = new JPanel(new GridBagLayout());
    updateShown();

    myScrollPanel.setBorder(null);
    int attrCount = myUnsetAttributes.length;
    if (myMustEnterName && !Arrays.asList(myUnsetAttributes).contains(FileTemplate.ATTRIBUTE_NAME)) {
      attrCount++;
    }
    Insets insets = (attrCount > 1) ? new Insets(2, 2, 2, 2) : new Insets(0, 0, 0, 0);
    myScrollPanel.add(myAttrPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0));
    if (attrCount > 1) {
      myScrollPanel.add(new JPanel(), new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
      JScrollPane attrScroll = ScrollPaneFactory.createScrollPane(myScrollPanel);
      attrScroll.setViewportBorder(null);
      myMainPanel.add(attrScroll, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    }
    else {
      myMainPanel.add(myScrollPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    }
  }
  return myMainPanel;
}
 
Example #20
Source File: XQueryCreateFromTemplateHandler.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Override
protected String checkAppendExtension(String fileName, FileTemplate template) {
    if (hasExtension(fileName)) {
        return fileName;
    }
    XQuerySettings settings = XQuerySettings.getInstance(project);
    String extension = getExtension(template, settings);
    return fileName + "." + extension;
}
 
Example #21
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public FileTemplate findInternalTemplate(@Nonnull @NonNls String templateName) {
  FileTemplateBase template = getSettings().getInternalTemplatesManager().findTemplateByName(templateName);

  if (template == null) {
    // todo: review the hack and try to get rid of this weird logic completely
    template = getSettings().getDefaultTemplatesManager().findTemplateByName(templateName);
  }
  return template;
}
 
Example #22
Source File: FileReferenceQuickFixProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
private FileTemplate findTemplate(FileTemplateManager fileTemplateManager) {
  FileTemplate template = fileTemplateManager.getTemplate(myNewFileTemplateName);
  if (template == null) template = fileTemplateManager.findInternalTemplate(myNewFileTemplateName);
  if (template == null) {
    for (FileTemplate fileTemplate : fileTemplateManager.getAllJ2eeTemplates()) {
      final String fileTemplateWithExtension = fileTemplate.getName() + '.' + fileTemplate.getExtension();
      if (fileTemplateWithExtension.equals(myNewFileTemplateName)) {
        return fileTemplate;
      }
    }
  }
  return template;
}
 
Example #23
Source File: HaxeFileTemplateUtil.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public static List<FileTemplate> getApplicableTemplates() {
  return getApplicableTemplates(new Condition<FileTemplate>() {
    @Override
    public boolean value(FileTemplate fileTemplate) {
      return HaxeFileType.DEFAULT_EXTENSION.equals(fileTemplate.getExtension());
    }
  });
}
 
Example #24
Source File: GLSLCreateFromTemplateHandler.java    From glsl4idea with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Return map of extensions and their preferred template.
 * This map is obtained from taking all internal templates and overriding them with existing custom templates.
 */
private static Map<String, FileTemplate> getTemplates(Project project){
    final Map<String, FileTemplate> result = new HashMap<>();
    FileTemplateManager manager = FileTemplateManager.getInstance(project);
    addTemplates(result,manager.getInternalTemplates());
    addTemplates(result,manager.getAllTemplates());
    return result;
}
 
Example #25
Source File: GLSLCreateFromTemplateHandler.java    From glsl4idea with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void addTemplates(Map<String, FileTemplate> result, FileTemplate[] templates){
    for(FileTemplate template:templates){
        if(template.isTemplateOfType(GLSLSupportLoader.GLSL) && GLSLFileType.EXTENSIONS.contains(template.getExtension())){
            FileTemplate existing = result.get(template.getExtension());
            if(existing == null){
                //Do not replace existing templates to keep well defined priority order
                result.put(template.getExtension(), template);
            }
        }
    }
}
 
Example #26
Source File: CreateFromTemplateDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
public CreateFromTemplateDialog(@Nonnull PsiDirectory directory,
                                @Nonnull FileTemplate template,
                                @Nullable final AttributesDefaults attributesDefaults,
                                @Nullable final Map<String, Object> defaultProperties) {
  super(directory.getProject(), true);
  myDirectory = directory;
  myProject = directory.getProject();
  myTemplate = template;
  setTitle(IdeBundle.message("title.new.from.template", template.getName()));

  myDefaultProperties = defaultProperties == null ? FileTemplateManager.getInstance(myProject).getDefaultVariables() : defaultProperties;
  FileTemplateUtil.fillDefaultProperties(myDefaultProperties, directory);
  boolean mustEnterName = FileTemplateUtil.findHandler(template).isNameRequired();
  if (attributesDefaults != null && attributesDefaults.isFixedName()) {
    myDefaultProperties.put(FileTemplate.ATTRIBUTE_NAME, attributesDefaults.getDefaultFileName());
    mustEnterName = false;
  }

  String[] unsetAttributes = null;
  try {
    unsetAttributes = myTemplate.getUnsetAttributes(myDefaultProperties, myProject);
  }
  catch (ParseException e) {
    showErrorDialog(e);
  }

  if (unsetAttributes != null) {
    myAttrPanel = new CreateFromTemplatePanel(unsetAttributes, mustEnterName, attributesDefaults);
    myAttrComponent = myAttrPanel.getComponent();
    init();
  }
  else {
    myAttrPanel = null;
    myAttrComponent = null;
  }
}
 
Example #27
Source File: BitrixFramework.java    From bxfs with MIT License 5 votes vote down vote up
@Override
	public void projectOpened() {
//		projectSourceRoots = ProjectRootManager.getInstance(project).getContentSourceRoots();
//		for (VirtualFile resourceRoot : WebResourcesPathsConfiguration.getInstance(project).getResourceDirectories()) {
//			projectResourceRoots = Arrays.copyOf(projectResourceRoots, projectResourceRoots.length + 1);
//			projectResourceRoots[projectResourceRoots.length - 1] = resourceRoot;
//		}
		project.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, this);

		/* Шаблоны страниц */
		FileTemplateManager templateManager = FileTemplateManager.getInstance(project);

		for (String templateName : templates.keySet()) {
			if (null == templateManager.findInternalTemplate(templateName)) {
				Optional<String> content = getResourceFileContent(
					"fileTemplates/" + templates.get(templateName) + ".php.ft");

				if (content.isPresent()) {
					FileTemplate template
						= templateManager.addTemplate(templateName, "php");

					template.setText(content.get());
					template.setReformatCode(true);
				}
			}
		}
	}
 
Example #28
Source File: NodeTypeCreateFromTemplateHandler.java    From intellij-neos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void prepareProperties(Map<String, Object> props) {
    String name = (String) props.get(FileTemplate.ATTRIBUTE_NAME);
    String nameWithoutPrefix = name.replaceFirst("NodeTypes\\.", "");

    props.put("NEOS_NODE_TYPE_NAME", nameWithoutPrefix);
}
 
Example #29
Source File: CreateFileTemplateAction.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private void restoreTemplate(FileTemplate newTemplate, FileTemplateManager ftm) {
    // Restore Old
    if (backupTemplate != null) {
        newTemplate.setText(backupTemplate.getText());
        newTemplate.setExtension(backupTemplate.getExtension());
        newTemplate.setLiveTemplateEnabled(backupTemplate.isLiveTemplateEnabled());
        newTemplate.setReformatCode(backupTemplate.isReformatCode());
    } else {
        ftm.removeTemplate(newTemplate);
    }
}
 
Example #30
Source File: CreateFileTemplateAction.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private void doRunInWrite() {
        String text = FileReaderUtil.readFile(fileFrom);

        if (text == null) {
            ReportHelper.setState(ExecutionState.FAILED);
            ReportHelper.putReport(new FailedActionReport(this, Localizer.get("error.ReadFileContent"), "FileReaderUtil.readFile return null"));
            return;
        }


        FileTemplateManager ftm = FileTemplateHelper.getManagerInstance(project);
        FileTemplate oldTemplate = ftm.getTemplate(StringTools.getNameWithoutExtension(fileFrom.getName()));

        if (oldTemplate != null) {
            ftm.removeTemplate(oldTemplate);
//            ftm.saveAllTemplates();
        }

        FileTemplate[] templates = ftm.getAllTemplates();

        FileTemplate template = FileTemplateUtil.createTemplate(
                StringTools.getNameWithoutExtension(fileFrom.getName()),
                StringTools.getExtensionFromName(fileFrom.getName()),
                text, templates
        );
        ftm.setTemplates(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, Arrays.asList(ArrayUtil.append(templates, template)));


        ReportHelper.putReport(new SuccessActionReport(this, toString()));
    }