STS自定义模板

时间:2014-05-19 16:10:24

标签: java json spring templates sts-springsourcetoolsuite

我在STS中遇到创建自定义模板的问题。我想要的是能够在项目的所有文件中进行基于令牌的替换。我已经读过这可能是“令牌”替换,但似乎无法让wizard.json让我接受多个输入。你到处看到的“例子”正在取代顶级包,我必须工作得很好。

任何人都有任何在wizard.json中做多个输入的例子,或者对我做错了什么有任何想法?

这是我所拥有的,但不起作用:

{
"info" : {
    "elements" : {
        "element" : [
            {
                "name" : "mysystem",
                "description" : "Please the name of your system (ex. marketing, hr, accounting, etc).",
                "type" : "java.lang.String",
                "page" : 0,
                "required" : true,
                "pattern" : "\\w+",
                "replaceKind" : "token"
            }
        ],
        "element" : [
            {
                "name" : "myapp",
                "description" : "Please the name of your application (ex. thisapplication, thatapplication, etc).",
                "type" : "java.lang.String",
                "page" : 0,
                "required" : true,
                "pattern" : "\\w+",
                "replaceKind" : "token"
            }
        ]
    },

    "projectName" : "projectName",

    "pages" : {
        "page" : [
                {
                "order" : 0,
                "description" : "System Info"
                }
          ]
    }
}
}

“myapp”选择并进行翻译,但“mysystem”甚至从未显示输入(屏幕一只是myapp文本)。

1 个答案:

答案 0 :(得分:0)

对于那些遇到同样问题的人,我已经想到了这一点。这就是我最终的目标。

{
"info" : {
    "elements" : {
        "element" : [
            {
                "name" : "mysystem",
                "description" : "Please the name of your system (ex. marketing, hr, accounting, etc).",
                "type" : "java.lang.String",
                "page" : 0,
                "required" : true,
                "pattern" : "\\w+",
                "replaceKind" : "token"
            },
            {
                "name" : "myapp",
                "description" : "Please the name of your application (ex. thisapplication, thatapplication, etc).",
                "type" : "java.lang.String",
                "page" : 1,
                "required" : true,
                "pattern" : "\\w+",
                "replaceKind" : "token"
            }
        ]
    },

    "projectName" : "projectName",

    "pages" : {
        "page" : [
                {
                "order" : 0,
                "description" : "System Info"
                }
          ],
          "page" : [
                {
                "order" : 1,
                "description" : "System Info 2"
                }
          ]
    }
}

}