Changes for page Custom Project Templates

Last modified by Bastian Triller on 2009/04/11 21:03

From version 45.1
edited by David Avendasora
on 2009/04/11 21:01
Change comment: There is no comment for this version
To version 46.1
edited by David Avendasora
on 2009/04/11 20:37
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -105,9 +105,9 @@
105 105  
106 106  = Using Template Inputs =
107 107  
108 -So now that you have template inputs defined, you need to be able to use them. The name used in the "name" attribute of your input node will be the name of the variable you can use in your template's files. For instance, in the example above, the Velocity variable "servletDeployment" will be bound to the boolean value corresponding to the user's selection, and can be used just like any other velocity variable. The Apache project provides a [[Velocity reference guide>>http://velocity.apache.org/engine/devel/vtl-reference-guide.html]].
108 +So now that you have template input defined, you will want to be able to use them. The name use used in the "name" attribute of your input declaration will be the name of the variable in your Velocity context. For instance, in the example above, the Velocity variable "linkToWonderProjects" will be bound to the boolean value corresponding to the user's selection, and can be used just like any other velocity variable. The Apache project provides a [[Velocity reference guide>>http://velocity.apache.org/engine/devel/vtl-reference-guide.html]].
109 109  
110 -As an example, the .classpath file can be modified to automatically add a link to the JavaWOJSPServlet.framework if the user selects "Deploy to Servlet Container" in the the wizard.
110 +As an example, the .classpath file can be modified to automatically add a link to the JavaWOJSPServlet.framework if the user is prompted and selects "Deploy to Servlet Container" in the the new project wizard.
111 111  
112 112  {{code value="xml"}}
113 113  
... ... @@ -129,19 +129,6 @@
129 129  
130 130  {{/code}}
131 131  
132 -In addition to variables inside of Velocity templates, you can also use template variables in folder and file names. However, because $ is not allowed on some filesystems, we instead surround the variable names with "" (for instance $someVariable would be "someVariable" in the filename or path). As an example, the template above has an input named "basePackage" (of type Package) which, as we learned above, creates two variables: "basePackage" and "basePackage//folder". Since we are going to be using this variable to name (and define the path) of a folder in the Sources directory, we need to use the alternate version of the variable. Create a new folder in the Sources directory of the project templaet and instead of using "{{basePackage_folder}}{{/basePackage_folder}}" as the file name, we must use "basePackage//folder".
132 +In addition to variables inside of Velocity templates, you can also use template variables in folder and file names. However, because $ is not allowed on some filesystems, we instead surround the variable names with "" (for instance $someVariable would be someVariable in the filename or path). As an example, the Wonder Application template has an input named "basePackage" (of type Package), which creates a magic variable named "basePackage//folder" (where the dots are turned into slashes), and the Source folder on the filesystem is named "Wonder Application/Sources///basePackage//folder//".
133 133  
134 -= Special Circumstances =
135 -
136 -===== Flagging files to be skipped by Velocity =====
137 -
138 -If there are files in your template that should not be processed by Velocity as the project is being setup, you will need to end the file name with "binary" which will cause Velocity to strip the "binary" off the file name, but skip processing the contents of the file. Examples of files that you'd want to flag are:
139 -
140 -* EOGenerator Templates
141 -* Custom builder .launch files.
142 -
143 -===== Using keypaths =====
144 -
145 -* If you need to call a method on a given variable, you need to include the "()" at the end of the method name. An eample is in the build.properties file. In order to get the lowercase version of the project name, you have to call "{{projectName.toLowerCase()}}{{/projectName.toLowerCase()}}"
146 -
147 147  Happy templating