private static Template generateTemplate(Project project, List<String> names) {
    final TemplateManager templateManager = TemplateManager.getInstance(project);
    final Template template = templateManager.createTemplate("", "");
    template.setToReformat(true);

    final Result result = new TextResult(names.get(0));

    Expression expr = new ConstantNode(result).withLookupStrings(
      names.size() > 1 ? ArrayUtil.toStringArray(names) : ArrayUtilRt.EMPTY_STRING_ARRAY);
    template.addVariable("", expr, expr, true);

    return template;
  }
private static Template generateTemplate(Project project, List<String> names)