Changes for page Custom Project Templates
Last modified by Bastian Triller on 2009/04/11 21:03
From version 27.1
edited by Mike Schrag
on 2007/10/07 10:11
on 2007/10/07 10:11
Change comment:
There is no comment for this version
To version 33.1
edited by Mike Schrag
on 2007/10/03 16:14
on 2007/10/03 16:14
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,7 +2,7 @@ 2 2 3 3 To use a custom project template, select the "WO Project from Template" option under the WOLips category of the New Project Wizard. 4 4 5 -[[image: NewProjectFromTemplate.png]]5 +[[image:WOProjectFromTemplate.png]] 6 6 7 7 ==== Creating a Template ==== 8 8 ... ... @@ -10,8 +10,8 @@ 10 10 11 11 * The ProjectTemplates folder inside of the WOLips templateengine plugin jar 12 12 * /Library/Application Support/WOLips/Project Templates 13 -* YourHomeDirocuments and Settingspplication DataOLipsroject Templates 14 -* YourHomeDirocuments and SettingsppDataocalOLipsroject Templates 13 +* [[YourHomeDir]]ocuments and Settingspplication DataOLipsroject Templates 14 +* [[YourHomeDir]]ocuments and SettingsppDataocalOLipsroject Templates 15 15 * ,,/Library/Application Support/WOLips/Project Templates,, 16 16 17 17 Without any additional metadata, the template system derives the name of the template from the name of the folder in one of the above locations. For instance, if you create a folder named ",,/Library/Application Support/WOLips/Project Templates/Wonder Application," the template system will offer a template named "Wonder Application" in the template selection dialog. Project templates found later in the list of locations above will override those of the same name from earlier in the list. For instance, a "Wonder Application" template found in ,,/Library will overrode a "Wonder Application" template from /Library. ... ... @@ -28,8 +28,6 @@ 28 28 29 29 An example template.xml is below: 30 30 31 -{{code value="xml"}} 32 - 33 33 <?xml version="1.0" encoding="UTF-8"?> 34 34 <template name = "Wonder Application"> 35 35 <inputs> ... ... @@ -53,14 +53,10 @@ 53 53 </inputs> 54 54 </template> 55 55 56 -{{/code}} 57 - 58 58 The "name" attribute of the template node overrides the name of the folder the templates are in. For instance, you could have the above template.xml inside a folder named "Template 1" and the template system would consider the name of the template to be "Wonder Application." 59 59 60 -Within a template, you can declare a single "inputs" node that can contain multiple "input" nodes. Each input node corresponds to a variable that will be presented to the user on the second page of the wizard. Each input specifies a "name" attribute, which will become the variable name of the input for later reference in the Velocity templates; and a "type" attribute which can be one of Boolean, String, Package,or Integer. The type value determines the control that will be used to display the input to the user (String = text field, Boolean = checkbox, Integer = spinner,Package=text field, etc). Each input also contains a "question" node, whose value corresponds to the label of the control when displayed to the user. In the above example, the "linkToWonderFrameworks" will display a checkbox to the user with the label "Link to Wonder Frameworks?". Additionally, you can provide a "default" node that defines the default value of the variable. If a default is not specified, the default value will be null for all input types.56 +Within a template, you can declare a single "inputs" node that can contain multiple "input" nodes. Each input node corresponds to a variable that will be presented to the user on the second page of the wizard. Each input specifies a "name" attribute, which will become the variable name of the input for later reference in the Velocity templates; and a "type" attribute which can be one of Boolean, String, or Integer. The type value determines the control that will be used to display the input to the user (String = text field, Boolean = checkbox, Integer = spinner, etc). Each input also contains a "question" node, whose value corresponds to the label of the control when displayed to the user. In the above example, the "linkToWonderFrameworks" will display a checkbox to the user with the label "Link to Wonder Frameworks?". Additionally, you can provide a "default" node that defines the default value of the variable. If a default is not specified, the default value will be null for all input types. 61 61 62 -The package type is slight extension to the String type. For a variable declared as type Package, in addition to having your variable bound, you will also have a variable named "yourvariablename//folder" with replaces dots for slashes. For instance, if your variable is named "basePackage," you will also get a variable named "basePackage//folder." This is useful because you can use template variables in folder names on the filesystem. 63 - 64 64 Finally, the input system supports the declaration of enumerated types. By declaring an "options" node that contains an ordered set of "option" nodes, you can define the possible values that the user can provide. In the above example, the "YourFavoriteColor" input defines three options: Red, Green, and Blue. Each option node has a "name" attribute, which will be the value displayed to the user, and a "value" attribute, which will be the actual backing value of the selection. The value of the option should be of the type specified in the "type" attribute of the input. For instance, if you declare the input type to be "Integer," your option values should be integer values (in quotes). 65 65 66 66 ==== Using Template Inputs ==== ... ... @@ -69,8 +69,6 @@ 69 69 70 70 As an example, the Wonder Application template's .classpath file is defined as: 71 71 72 -{{code value="xml"}} 73 - 74 74 <?xml version="1.0" encoding="UTF-8"?> 75 75 <classpath> 76 76 <classpathentry kind="src" path="Sources"/> ... ... @@ -81,16 +81,12 @@ 81 81 <classpathentry combineaccessrules="false" kind="src" path="/JavaWOExtensions"/> 82 82 #end 83 83 #if ($linkToWonderFrameworks) 84 - <classpathentry kind="con" path="org.objectstyle.wolips.WO _CLASSPATH/ERExtensions/ERJars/ERPrototypes/JavaWOExtensions/JavaEOAccess/JavaEOControl/JavaFoundation/JavaJDBCAdaptor/JavaWebObjects/JavaXML"/>76 + <classpathentry kind="con" path="org.objectstyle.wolips.WO//CLASSPATH/ERExtensions/ERJars/ERPrototypes/JavaWOExtensions/JavaEOAccess/JavaEOControl/JavaFoundation/JavaJDBCAdaptor/JavaWebObjects/JavaXML"/> 85 85 #else 86 - <classpathentry kind="con" path="org.objectstyle.wolips.WO _CLASSPATH/JavaEOAccess/JavaEOControl/JavaFoundation/JavaJDBCAdaptor/JavaWebObjects/JavaXML"/>78 + <classpathentry kind="con" path="org.objectstyle.wolips.WO//CLASSPATH/JavaEOAccess/JavaEOControl/JavaFoundation/JavaJDBCAdaptor/JavaWebObjects/JavaXML"/> 87 87 #end 88 - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE _CONTAINER"/>80 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE//CONTAINER"/> 89 89 <classpathentry kind="output" path="bin"/> 90 - </classpath> 82 + </classpath>// 91 91 92 -{{/code}} 93 - 94 -In addition to variables inside of Velocity templates, you can also use template inputs in folder names. For instance, 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". 95 - 96 96 Happy templating!