The structure or schema for a project template is as follows:
</p>
<pclass="CodeBlock"><code><template <br>type="TemplateType" <br>version="Version" <br>supplier="Supplier" <br>revision="Revision" <br>author="Author" <br>id="TemplateId" <br>label="Template label visible to the user" <br>description="A brief description of the template" <br>help="help.html" <br>preview-icon="icon.gif"><br><br><property-group <br>id="properyGroupId" <br>label="Property group label" <br>description="A simple description of the property group" <br>type=" Type of UIElement group" <br>help="help.html"<br>branding-icon="icon.gif"><br>...<br></property-group><br><br><process><br>...<br></process><br><br></template></code></p>
<p>
The root element for a project template is <code>template</code>, which
provides the following properties or attributes to describe the template:
</p>
<ul>
<li>
<p>
<code>type</code>: Use this attribute to specify the template type.
For a project template the <code>type</code> should be <code>ProjTempl</code>.
</p>
<li>
<p>
<code>version</code>: Use this attribute to specify the major version
number of the template.
</p>
<li>
<p>
<code>supplier</code>: Use this attribute to specify the name of the
supplier who provided the template.
</p>
<li>
<p>
<code>revision</code>: Use this attribute to specify the minor
version number of the template.
</p>
<li>
<p>
<code>author</code>: Use this attribute to specify the template
author's name.
</p>
<li>
<p>
<code>id</code>: Use this attribute to specify a unique name for the
template.
</p>
<li>
<p>
<code>label</code>: Use this attribute to specify a label for the
template, which briefly describes the purpose of the template. For example, if
you are defining a template for a Helloworld <codeclass="filename">EXE</code>
application, the label can be "HelloWorld <codeclass="filename">EXE</code>
Application".
</p>
<li>
<p>
<code>description</code>: Use this attribute to provide a description
for the template, which is displayed to users when they choose the template
from the list of available templates.
</p>
<li>
<p>
<code>help</code>: Use this attribute to specify the HTML help file
name for the template.
</p>
<li>
<p>
<code>preview-icon</code>: Use this attribute to specify a
<codeclass="filename">GIF</code> or <codeclass="filename">JPG</code> file name to be used as a icon for the
template. There are no constraints on the image, as this attribute is meant for
future use.
</p>
</li>
</ul>
<p>
The <code>template</code> element includes the following child elements:
</p>
<ul>
<li>
<p>
<code>property-group</code>: A property-group element represents a
wizard page in the New Project wizard. It lists all the fields to be displayed
to the user for input using the <code>property</code> element. For example, you
could use this element to define all the input fields to be displayed in the
<em>Project Directories</em> page of the New Project wizard.
</p>
<li>
<p>
<code>process</code>: A process element defines the process of
creating the project in the Eclipse workspace, based on the user input values.
For example, if the user specifies "include" as the folder name for all the
header files, the process of creating a folder by that name and copying all the
header files to it is defined here.
</p>
</li>
</ul>
<h4class="subheading">
property-group
</h4>
<p>
As mentioned earlier, a <code>property-group</code> includes the
<code>property</code> elements that specify all the input fields required for a
wizard page. A <code>property-group</code> can include any number of
<code>property</code> elements. The following attributes can be used to
describe a property group:
</p>
<ul>
<li>
<p>
<code>id</code>: Use this attribute to specify a unique ID for the
property group.
</p>
<li>
<p>
<code>label</code>: Use this attribute to specify a name for the
property group, which is displayed as a title of the wizard page generated by
the Template Engine.
</p>
<li>
<p>
<code>description</code>: Use this attribute to provide a short
description of the property group, which is displayed below the wizard page
<code>help</code>: Use this attribute to specify the HTML help file
name for the property group.
</p>
<li>
<p>
<code>branding-icon</code>: Use this attribute to specify a
<codeclass="filename">GIF</code> file name to be used as an icon for the property group.
</p>
</li>
</ul>
<h4class="subheading">
property
</h4>
<p>
The syntax for the <code>property</code> elements included by the
property-group element is as follows:
</p>
<pclass="CodeBlock"><code><property <br>id="propertyId"<br>label="User visible label of the property"<br>description="A brief description of the property"<br>type="type of the property"<br>pattern="Regular expression of the expected property"<br>default="Default value of the property"<br>size="size"<br>mandatory="true|false"<br>hidden="true|false"<br>persist="true|false"><br><br> <item <br> name="name of the item"<br> label="User visible label of the item"<br> selected="true|false"><br> ...<br> </item><br></property></code></p>
<p>
Here is a list of attributes of the <code>property</code> element:
</p>
<ul>
<li>
<p>
<code>id</code>: Use this attribute to specify a unique ID for the
property.
</p>
<li>
<p>
<code>label</code>: Use this attribute to specify a name for the
property, which is displayed as a label in the wizard page next to the input
field.
</p>
<li>
<p>
<code>description</code>: Use this attribute to provide a short
description of the property, which is displayed whenever the mouse hovers over
the label.
</p>
<li>
<p>
<code>type</code>: Use this attribute to specify the property type.
The possible values for this attribute are:
</p>
<ul>
<li>
<p>
<code>input</code>: If you want a text input box.
</p>
<li>
<p>
<code>multiline</code>: If you want a multiline input box.
</p>
<li>
<p>
<code>select</code>: If you want a drop-down combo box.
</p>
<li>
<p>
<code>boolean</code>: If you want an option button.
</p>
<li>
<p>
<code>stringlist</code>: If you want a list box.
</p>
<li>
<p>
<code>speciallist</code>: If you want a list box with buttons to
add and delete items to it.
</p>
<li>
<p>
<code>browse</code>: If you want a browse field to choose a file
or directory using the File Open dialog.
</p>
</li>
</ul>
<li>
<p>
<code>pattern</code>: Use this attribute to specify the input
character pattern for the property using regular expressions. For more
information on regular expression patterns, refer to Java API document for
<code>default</code>: Use this attribute to specify a default value
for the property.
</p>
<li>
<p>
<code>size</code>: Use this attribute to specify the size of the
property. Note that this attribute is relevant only if the property type is
<code>input</code> or <code>multiline</code>.
</p>
<li>
<p>
<code>mandatory</code>: Use this attribute to specify whether the
property is mandatory or not. The value for this attribute can either be
<code>true</code> or <code>false</code>.
</p>
<li>
<p>
<code>hidden</code>: Use this attribute to specify whether the
property is visible to the user or not. The value for this attribute can either
be <code>true</code> or <code>false</code>.
</p>
<li>
<p>
<code>persist</code>: Use this attribute to specify whether the
property should persist its value or not. The value for this attribute can
either be <code>true</code> or <code>false</code>.
</p>
</li>
</ul>
<p>
If the property <code>type</code> is <code>select</code> or
<code>stringlist</code>, you can include the <code>item</code> element to
specify the items to be listed. There is no limitation on the number of items
that can be listed. Here is the syntax for the <code>item</code> element:
</p>
<pclass="CodeBlock"><code><item <br>name="name of the item"<br>label="User visible label of the item"<br>selected="true|false"><br></item></code></p>
<p>
Here is a list of attributes of the <code>item</code> element:
</p>
<ul>
<li>
<p>
<code>name</code>: Used to specify a unique name for the list item.
</p>
<li>
<p>
<code>label</code>: Used to specify a label that is displayed to the
user.
</p>
<li>
<p>
<code>selected</code>: Used to specify whether the list item is
selected by default. The value for this attribute can either be
<code>true</code> or <code>false</code>.
</p>
</li>
</ul>
<h4class="subheading">
process
</h4>
<p>
The <code>process</code> element within the root element of a project
template defines the processes to be followed to create a project, based on the
inputs taken. Here is the syntax for this element: