diff options
author | Andrew Ferguson | 2007-06-21 10:49:16 +0000 |
---|---|---|
committer | Andrew Ferguson | 2007-06-21 10:49:16 +0000 |
commit | a86a73a2e2d8e9bfcc27f7b417ab469b3d218949 (patch) | |
tree | a91157e07ae69465086d0e1b814290809791c778 | |
parent | dcb1c0b58546263e23a15ebf3aa838437072ca8c (diff) | |
download | org.eclipse.cdt-a86a73a2e2d8e9bfcc27f7b417ab469b3d218949.tar.gz org.eclipse.cdt-a86a73a2e2d8e9bfcc27f7b417ab469b3d218949.tar.xz org.eclipse.cdt-a86a73a2e2d8e9bfcc27f7b417ab469b3d218949.zip |
160012: add ISV docs for template engine
17 files changed, 1460 insertions, 0 deletions
diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/Howtodeveloptemplates.html b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/Howtodeveloptemplates.html new file mode 100644 index 00000000000..3861e5ab5ba --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/Howtodeveloptemplates.html @@ -0,0 +1,830 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html><head> +<title>How to develop templates in How to extend the user interface using templates</title> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="screen"> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="print"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css" media="screen"> + .ButtonBox { background-image: url(_stock/gradient.jpg); } + </style> + </head> + <body> + <table width="100%" border="0" cellspacing="0" + cellpadding="0"><tbody><tr> + </tr><tr><td class="DocSetBox" width="25%"> + <p> </p> + </td> + <td class="ButtonBox" align="right" width="40%"> + <p> <A href="index.html"><IMG height=22 + alt=[Previous] src="_stock/btn_prev_wt.gif" width=85 border=0 ></a> <A href="Howtoregistertemplates.html"><IMG height=22 alt=[Next] + src="_stock/btn_next_wt.gif" width=58 border=0 ></a></p> + </td> + </tr></tbody></table> + <hr noshade size="1"> + <p class="breadcrumbNav"><span class="separator">»</span> + <A href="index.html">How to extend the user interface using templates</a> <span class="separator">»</span> +How to develop templates</p> + + <hr noshade size="1"> + <div class="AuthoredContent"> + + +</div><div class="Head1"> + +<h1>How to develop templates</h1> +</div><div class="Bodytext"> +<p> +Templates form an important part of the drive to support automatic GUI generation + of various user interface types as supported in Eclipse frame work. +These templates are often referred as project +templates, as they are used to support the creation of ready-made projects. For +example, you can define a template to create a simple GUI based +<code class="filename">EXE</code> application for a set of Build Configurations. +</p> +<p> +The project templates are simple XML files, which follow a structure or +schema defined in the <code class="filename">TemplateDescriptorSchema.xsd</code> file. These +templates define the inputs and processes required to create a project for a +particular platform. Inputs define the type of inputs required such as, files, +settings etc. The processes define what to do with those inputs to create a +particular type of project. +</p> +<p> +The New Project wizard lists all the templates available based on the +matching criteria defined by the templates. Once the user selects a template from the list, the +Template Engine plug-in processes the selected template. The plug-in generates the subsequent wizard +pages based on whether the template needs user input or not. +</p> +<p> +This document details the schema for writing project templates. The +schema file <code class="filename">TemplateDescriptorSchema.xsd</code>, which defines the +structure for the project templates, is part of +<code class="filename">org.eclipse.cdt.templateengine</code> plug-in. +</p> +<p> +The structure or schema for a project template is as follows: +</p> +<p class="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 <code class="filename">EXE</code> +application, the label can be "HelloWorld <code class="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 +<code class="filename">GIF</code> or <code class="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> +<h4 class="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 +title. +</p> +<li> +<p> +<code>type</code>: Use this attribute to specify the wizard page +type. The possible values for this attribute are: +</p> +<ul> +<li> +<p> +<code>PAGES_ONLY</code>: If you want all the properties to be +listed in a simple page. +</p> +<li> +<p> +<code>PAGES_TAB</code>: If you want all the properties to be +displayed as tabs in a page. +</p> +<li> +<p> +<code>PAGES_TREE</code>: If you want all the properties to be +displayed in a simple tree structure. +</p> +<li> +<p> +<code>PAGES_TREE_TREE</code>: If you want all the properties to +be displayed in a multi-level tree structure. +</p> +<li> +<p> +<code>PAGES_TAB_TREE</code>: If you want all the properties to be +displayed as tabs or as a tree structure. +</p> +</li> +</ul> +<li> +<p> +<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 +<code class="filename">GIF</code> file name to be used as an icon for the property group. +</p> +</li> +</ul> +<h4 class="subheading"> +property +</h4> +<p> +The syntax for the <code>property</code> elements included by the +property-group element is as follows: +</p> +<p class="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 +<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>. +</p> +<li> +<p> +<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> +<p class="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> +<h4 class="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: +</p> +<p class="CodeBlock"><code><process type="org.eclipse.cdt.templateengine.<process type>"><br> <simple name="name" value=""/> <br><br> <complex name="name"> <br> ...<br> </complex> <br><br> <simple-array name="values"><br> ...<br> </simple-array><br><br> <complex-array name="name"><br> ...<br> </complex-array> <br><br></process></code></p> +<p> +A <code>process</code> element defines a single process. A process is +like a procedure with a set of parameters. In similar terms, the +<code>process</code> element defines the procedure. You need to specify all the +parameters expected by a process. In the project template, you need to specify +arguments for the process matching their types and in the order specified. +</p> +<p> +You can specify the process type using the <code>type</code> attribute. +For example, to add files to a project you can use +<code>org.eclipse.cdt.templateengine.AddFiles</code> as the process type. +</p> +<p> +A <code>process</code> element may include the following child elements: +</p> +<ul> +<li> +<p> +<code>simple</code>: A simple string parameter. In a project +template, you need to specify a name for the parameter using the +<code>name</code> attribute along with the corresponding <code>value</code> +attribute. +</p> +<p> +Here is an example showing the usage of this element: +</p> +<p class="CodeBlock"><code><simple name="name" value="value" /></code></p> +<li> +<p> +<code>simple-array</code>: A simple string array parameter. In the +project template, you need to specify a name for the parameter using the +<code>name</code> attribute along with the corresponding <code>element</code> +children. You can have any number of <code>element</code> children per +<code>simple-array</code> element with the corresponding <code>value</code> +attribute. +</p> +<p> +Here is an example showing the usage of this element: +</p> +<p class="CodeBlock"><code><simple-array name="values"><br> <element value="value1" /><br> <element value="value2" /><br> </simple-array></code></p> +<li> +<p> +<code>complex</code>: A <code>complex</code> parameter groups +together any number of <code>simple</code>, <code>simple-array</code> and +<code>complex</code> parameters. In the project template, you need to specify a +name for the parameter using the <code>name</code> attribute along with the +corresponding children elements. +</p> +<p> +Here is an example showing the usage of this element: +</p> +<p class="CodeBlock"><code><complex name="name"> <br> <element><br> <simple name="name" value="value" /><br> <simple-array name="values"><br> <element value="value1" /><br> <element value="value2" /><br> </simple-array><br> </element><br> </complex></code></p> +<li> +<p> +<code>complex-array</code>: A complex-array parameter. Each element +of this parameter is of the type <code>complex</code>. In the project template, +you need to specify a name for the parameter using the <code>name</code> +attribute along with the corresponding <code>element</code> children. You can +have any number of element children per complex-array element with the +corresponding complex type arguments. +</p> +<p> +Here is an example showing the usage of this element: +</p> +<p class="CodeBlock"><code><complex-array name="values"><br> <element><br> <simple name="name1" value="value1" /> <br> <simple name="name2" value="value2" /> <br> <simple name="name3" value="value3" /> <br> </element><br> <element><br> <simple name="name4" value="value4" /> <br> <simple name="name5" value="value5" /> <br> <simple name="name6" value="value6" /> <br> </element><br> </complex-array></code></p> +</li> +</ul> +<h4 class="subheading"> +Process types +</h4> +<p> +A process type is a prototype of a process procedure. It defines the +parameters required to complete a procedure. For example, to copy a file you +need its source and destination information, which can be defined as parameters +for the copy process. +</p> +<p> +The Template Engine plug-in provides a set of process types using the +extension-point <code class="filename">org.eclipse.cdt.templateengine.processType</code>. Using +these process types you can describe a process in your template. For example, +you can describe the copy process by providing the source and destination +folder names. +</p> +<p> +The following is a list of process types provided by the Template Engine: +</p> +<ul> +<li> +<p> +<b>NewProject</b>: It defines all the parameters required for a +new C/C++ project and provides the fully qualified name of the class, which +processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>Name</em>: You use this parameter to specify the name of +the project. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>projectType</em>: You use this parameter to specify the +type of the project. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>location</em>: You use this parameter to specify the +location of the project. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>targetType</em>: You use this parameter to specify the +type of the target binary. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>configs</em>: You use this parameter to specify the build +configurations for the project. It is of type <code>simple</code>. +</p> +</li> +</ul> +<li> +<p> +<b>NewManagedProject</b>: It defines all the parameters +required for a new managed project and provides the fully qualified name of the +class, which processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>Name</em>: You use this parameter to specify the name of +the managed project. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>projectType</em>: You use this parameter to specify the +type of the managed project. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>location</em>: You use this parameter to specify the +location of the managed project. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>targetType</em>: You use this parameter to specify the +type of the target binary. It is of type <code>simple</code>. +</p> +<li> +<p> +<em>configs</em>: You use this parameter to specify the build +configurations for the managed project. It is of type <code>simple</code>. +</p> +</li> +</ul> +<li> +<p> +<b>Copy</b>: It defines all the parameters required to copy +files and provides the fully qualified name of the class, which processes these +parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>files</em>: You can use this parameter to list the files +to be copied. It is of type <code>complexArrary</code>. Each file to be copied +is represented by a baseType <code>element</code>, which contains the following +<code>simple</code> types: +</p> +<ul> +<li> +<p> +<em>source</em>: Use this to specify the source file +location in the file system. +</p> +<li> +<p> +<em>target</em>: Use this to specify the target location +for the file. +</p> +<li> +<p> +<em>replaceable</em>: Use this flag to specify whether +the file should be replaced or not, if it is found in the <code>target</code> +location. +</p> +</li> +</ul> +</li> +</ul> +<li> +<p> +<b>Append</b>: It defines all the parameters required to append +files to a project and provides the fully qualified name of the class, which +processes these parameters. For more information about the parameters, refer to +the <code>Copy</code> process type described above. +</p> +<li> +<p> +<b>AddFile</b>: It defines all the parameters required to add a +file to the project and provides the fully qualified name of the class, which +processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>projectName</em>: Use this parameter to specify the name +of the project to which the file should be copied. It is of <code>simple</code> +type. +</p> +<li> +<p> +<em>file</em>: Use this parameter to include information +related to source, target and replaceable. It is of <code>complex</code> type. +For more information about the parameters, refer to the <code>Copy</code> +process type described above. +</p> +</li> +</ul> +<li> +<p> +<b>AddFiles</b>: It defines all the parameters required to add +files to a project and provides the fully qualified name of the class, which +processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>projectName</em>: Use this parameter to specify the name +of the project to which the file should be copied. It is of <code>simple</code> +type. +</p> +<li> +<p> +<em>files</em>: Use this parameter to include information +related to source, target and replaceable. It is of <code>complexArray</code> +type. For more information about the parameters, refer to the <code>Copy</code> +process type described above. +</p> +</li> +</ul> +<li> +<p> +<b>CreateSourceFolder</b>: It defines all the parameters +required to create a folder for the source files in a project and provides the +fully qualified name of the class, which processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>projectName</em>: Use this parameter to specify the name +of the project to which the file should be copied. It is of <code>simple</code> +type. +</p> +<li> +<p> +<em>path</em>: Use this parameter to specify the path +relative to the project folder, where the folder for the source files should be +created. It is of <code>simple</code> type. +</p> +</li> +</ul> +<li> +<p> +<b>AddLink</b>: It defines all the parameters required to +create a linked file and provides the fully qualified name of the class, which +processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>projectName</em>: Use this parameter to specify the name +of the project in which the linked file should be created. It is of +<code>simple</code> type. +</p> +<li> +<p> +<em>filePath</em>: Use this parameter to specify the path of +the original file relative to the project folder. It is of <code>simple</code> +type. +</p> +<li> +<p> +<em>targetPath</em>: Use this parameter to specify the target +location relative to the project folder, where a linked file to the original +file should be created. It is of <code>simple</code> type. +</p> +</li> +</ul> +<li> +<p> +<b>CreateIncludeFolder</b>: It defines all the parameters +required to create a folder for the header files in a project and provides the +fully qualified name of the class, which processes these parameters. For +information about the parameters, refer to the <code>CreateSourceFolder</code> +process type described above. +</p> +<li> +<p> +<b>SetMBSStringOptionValue</b>: It defines all the parameters +required to create a string option value and provides the fully qualified name +of the class, which processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>projectName</em>: Use this parameter to specify the name +of the project for which the string option is created. It is of +<code>simple</code> type. +</p> +<li> +<p> +<em>resourcePaths</em>: Use this parameter to specify the +path of the resources. It is of <code>complexArray</code> type. Each resource +patth to be created is represented by a baseType <code>element</code>, which +contains the following <code>simple</code> types: +</p> +<ul> +<li> +<p> +<em>id</em>: Use this parameter to specify a unique ID +for the resource path. It is of <code>simple</code> type. +</p> +<li> +<p> +<em>value</em>: Use this parameter to specify a value for +the resource path. It is of <code>simple</code> type. +</p> +<li> +<p> +<em>path</em>: Use this parameter to specify the path of +the resource. It is of <code>simple</code> type. +</p> +</li> +</ul> +</li> +</ul> +<li> +<p> +<b>SetMBSStringListOptionValues</b>: It defines all the +parameters required to create a string list of option values and provides the +fully qualified name of the class, which processes these parameters. The +parameters required are similar to that of <code>SetMBSStringOptionValue</code> +process type, only difference is that each resource path will have a list of +option values. For information about the parameters, refer to the +<code>SetMBSStringOptionValue</code> process type described above. +</p> +<li> +<p> +<b>SetMBSBooleanOptionValue</b>: It defines all the parameters +required to create a boolean option value and provides the fully qualified name +of the class, which processes these parameters. The parameters required are +similar to that of <code>SetMBSStringOptionValue</code> process type, only +difference is that this process type is used to create boolean option value. +For information about the parameters, refer to the +<code>SetMBSStringOptionValue</code> process type described above. +</p> +<li> +<p> +<b>AppendMBSStringOptionValue</b>: It defines all the +parameters required to append a string option value to an existing string +option. It also provides the fully qualified name of the class, which processes +these parameters. For information about the parameters, refer to the +<code>SetMBSStringOptionValue</code> process type described above. +</p> +<li> +<p> +<b>AppendCreate</b>: It defines all the parameters required to +append or create a file in a project. It also provides the fully qualified name +of the class, which processes these parameters. For information about the +parameters, refer to the <code>AddFiles</code> process type described above. +</p> +<li> +<p> +<b>CreateResourceIdentifier</b>: It defines all the parameters +required to append or create a resource identifier. It also provides the fully +qualified name of the class, which processes these parameters. +</p> +<p> +Here is a list of parameters defined by this process type: +</p> +<ul> +<li> +<p> +<em>valueName</em>: Use this attribute to specify a name for +the resource identifier. It is of <code>simple</code> type. +</p> +<li> +<p> +<em>appName</em>: Use this attribute to specify application, +which will be using this resource identifier. It is of <code>simple</code> +type. +</p> +</li> +</ul> +</li> +</ul> +<p> +Once the project template has been written, register it with Eclipse to +make it available for use. For more information on this, refer to +<A href="Howtoregistertemplates.html#Howto%2eregister%2etemplates">How to register a template with Eclipse</a>. +</p> +<a name="1.38"></a> +</div><div class="Head2"> +<hr size="2" noshade> +<h2>See also:</h2> +</div><div class="Bodytext"> +<ul> +<li> +<p> +<A href="Howtoregistertemplates.html#Howto%2eregister%2etemplates">How to register a template with Eclipse</a> +</p> +<li> +<p> +<A href="exampletemplate.html#Corona%2ecustomguide%2eexampletemplate">Example template</a> +</p> +</li> +</ul> + + </div><div class="Footer"> + <hr noshade size="1"> + <table cellpadding="0" cellspacing="0" border="0" width="100%"> + <tr> + <td class="ButtonBottomBox" align="right" height="12" width="67%"> + <p> + <A href="index.html"><IMG height=22 + alt=[Previous] src="_stock/btn_prev.gif" width=85 border=0 ></a> + <A href="#_top"><IMG alt=[Top] src="_stock/btn_top.gif" align=bottom border=0></a> + <A href="Howtoregistertemplates.html"><IMG height=22 alt=[Next] + src="_stock/btn_next.gif" width=58 border=0 ></a> + </p> + </td> + </tr> + </table> + </div> + </body> + </html> + diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/Howtoregistertemplates.html b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/Howtoregistertemplates.html new file mode 100644 index 00000000000..cace8220a0f --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/Howtoregistertemplates.html @@ -0,0 +1,197 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html><head> +<title>How to register a template with Eclipse in How to extend the user interface using templates</title> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="screen"> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="print"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css" media="screen"> + .ButtonBox { background-image: url(_stock/gradient.jpg); } + </style> + </head> + <body> + <table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr> + </tr><tr><td class="DocSetBox" width="25%"> + <p> </p> + </td> + <td class="ButtonBox" align="right" width="40%"> + <p> <A href="Howtodeveloptemplates.html"><IMG height=22 alt=[Previous] src="_stock/btn_prev_wt.gif" width=85 border=0 ></A> <A href="exampletemplate.html"><IMG height=22 alt=[Next] src="_stock/btn_next_wt.gif" width=58 border=0 ></A></p> + </td> + </tr></tbody></table> + <hr noshade size="1"> + <p class="breadcrumbNav"><span class="separator">»</span> + <A href="index.html">How to extend the user interface using templates</A> <span class="separator">»</span> +How to register a template with Eclipse</p> + + <hr noshade size="1"> + <div class="AuthoredContent"> + + +</div><div class="Head1"> + +<h1>How to register a template with Eclipse</h1> +</div><div class="Bodytext"> +<p> +Once the project template is ready, you need to register it with Eclipse +to make the template available for use. It is a good practice to group all the +files and resources related to the project template together in one folder. For +example, if you are writing a project template for a Hello World Application, +group all the resources required for this application in a folder +"HelloWorld". +</p> +<p> +To register a project template with Eclipse follow the steps given below: +</p> +<ol> +<li> +<p> +Create an empty plug-in project from the Eclipse workbench without +the source folders. +</p> +<li> +<p> +Create a folder and copy the project template along with all the +resources required to create the project. For example, all the hearder files, +source files, resource files etc. +</p> +<li> +<p> +Open the plug-in manifest editor and select the +<code class="ProgramOutput">Dependencies</code> page. For more information on plug-in manifest +editor, refer to <i>PDE + Guide > Getting Started > Basic Plug-in Tutorial +> Plug-in manifest editor</i>. +</p> +<li> +<p> +Click <code>Add</code> to select +<code class="filename">org.eclipse.cdt.templateengine</code> plug-in from the list. +</p> +<li> +<p> +Select the <code>Extensions</code> page in the plug-in manifest +editor. +</p> +<li> +<p> +Click <code>Add</code> to create an extension to the extension-point. +</p> +<li> +<p> +Select the extension-point with ID +<code class="filename">org.eclipse.cdt.templateengine.templates</code> from the list of +extensions-points. +</p> +<li> +<p> +Right-click on the newly added extension, and select +<code class="ProgramOutput">New</code> > +<code class="ProgramOutput">template</code> from the context menu. +</p> +<li> +<p> +Choose the new template added in step 6 from the <code class="ProgramOutput">All +Extensions</code> list. +</p> +<li> +<p> +Specify the <code class="ProgramOutput">wizardId</code> attribute of the template as +"<em>org.eclipse.cdt.project.ui.NewProjectWizard</em>". This +attribute is mandatory. +</p> +<li> +<p> +Specify the location of the template relative to the plug-in created +in step 1. This attribute is mandatory. +</p> +<li> +<p> +Specify a <code class="ProgramOutput">filterPattern</code> to indicate the build +Configurations for which the template is created. It is a regular expression used +to filter the build Configurations. If the template is designed for a particular +Configuration, it is recommended to specify the filter pattern. For example, If +the template is designed for GCC Configurations, the filter pattern can be ".*gcc". + If the template is designed for multiple build Configurations, you can specify + the filter patterns delimited by "|" . +</p> +<p> +The New Project wizard filters the available build Configurations based on the filter +pattern for the selected template. The filter patterns are matched against the +available Configurations' ID to get a list of matching SDKs. This is an optional +attribute. +</p> +<p> +For more information on regular expression patterns, refer to Java +API document for +<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>. +</p> +<li> +<p> +Select an appropriate project type from the +<code class="ProgramOutput">projectType</code> drop-down list. This is an optional attribute. +</p> +<li> +<p> +Specify the <code class="ProgramOutput">usageDescription</code>, which is a notation +describing how this template is used. Usually used to filter the list of +templates on offer depending on other wizard attributes. This is an optional +attribute. For more information, refer to Java API document for +<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html">java.util.regex.Pattern</a>. +</p> +<p> +The New Project wizard will list only those templates, which are +relevant for the build Configurations choosen for the project. For a example, if the developer +choose to create a <code class="ProgramOutput">C++ Application for Symbian OS</code>, the wizard +will list all the templates with the relevant +<code class="ProgramOutput">usageDescription</code>. Otherwise, for a standard <code class="ProgramOutput">CDT +C++ Project</code> the wizard will list all the templates, irrespective of +whether the <code class="ProgramOutput">usageDescription</code> is specified or not. +</p> +<li> +<p> +Specify the <code class="ProgramOutput">pagesAfterTemplateSelectionProvider</code>, +which is a fully qualified name of the class that implements +<code class="filename">org.eclipse.cdt.templateengine.IPagesAfterTemplateSelectionProvider</code> +interface. This is an optional attribute. +</p> +</li> +</ol> +<p> +After creating the plug-ins and registering the templates, launch a +runtime workbench and invoke the New Project wizard to check that the template +you added is listed. +</p> +<a name="1.7"></a> +</div><div class="Head2"> +<hr size="2" noshade> +<h2>See also:</h2> +</div><div class="Bodytext"> +<ul> +<li> +<p> +<A href="Howtodeveloptemplates.html#howto%2edevelop%2etemplates">How to develop templates</A> +</p> +<li> +<p> +<A href="exampletemplate.html#Corona%2ecustomguide%2eexampletemplate">Example template</A> +</p> +</li> +</ul> + + </div><div class="Footer"> + <hr noshade size="1"> + <table cellpadding="0" cellspacing="0" border="0" width="100%"> + <tr> + <td class="ButtonBottomBox" align="right" height="12" width="67%"> + <p> + <A href="Howtodeveloptemplates.html"><IMG height=22 alt=[Previous] src="_stock/btn_prev.gif" width=85 border=0></A> + <A href="#_top"><IMG alt=[Top] src="_stock/btn_top.gif" align=bottom border=0></A> + <A href="exampletemplate.html"><IMG height=22 alt=[Next] src="_stock/btn_next.gif" width=58 border=0 ></A> + </p> + </td> + </tr> + </table> + </div> + </body> + </html> + diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up.gif Binary files differnew file mode 100644 index 00000000000..3fc958e352b --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up_2.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up_2.gif Binary files differnew file mode 100644 index 00000000000..44419165c40 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up_2.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/basicsettings.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/basicsettings.gif Binary files differnew file mode 100644 index 00000000000..aec95acf512 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/basicsettings.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next.gif Binary files differnew file mode 100644 index 00000000000..045254173fe --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next_wt.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next_wt.gif Binary files differnew file mode 100644 index 00000000000..ffe4e24c784 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next_wt.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev.gif Binary files differnew file mode 100644 index 00000000000..dfb39c574a0 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev_wt.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev_wt.gif Binary files differnew file mode 100644 index 00000000000..88fbefb3dd3 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev_wt.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_top.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_top.gif Binary files differnew file mode 100644 index 00000000000..fe1b1528e33 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_top.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/explorerview.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/explorerview.gif Binary files differnew file mode 100644 index 00000000000..d782980b3a5 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/explorerview.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/gradient.jpg b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/gradient.jpg Binary files differnew file mode 100644 index 00000000000..ffff5f6689f --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/gradient.jpg diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/projectdirectories.gif b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/projectdirectories.gif Binary files differnew file mode 100644 index 00000000000..4b2503b70e0 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/projectdirectories.gif diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/sysdoc.css b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/sysdoc.css new file mode 100644 index 00000000000..269cd743ec5 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/sysdoc.css @@ -0,0 +1,272 @@ +/* -*- c -*- + System Documentation HTML presentation stylesheet. + Copyright 2000 Symbian Software Ltd. + */ + + +/* Overall page styles */ + +body { + background-color: white; + color: black; +} + +body, .Bodytext, p, td, th, ul, ol, li, dl, dt, dd, +.Head1, .Head2, .Head3, h1, h2, h3, h4, h5, h6, .Author, +.Abstract, .Contents1, .Contents2 { + font-family: arial, lucida, helvetica, verdana, sans-serif; + font-size: 10pt; +} + +a:link { color: #0000cc; } +a:visited { color: #663399; } +a:active { color: #ff9900; } +a:hover { color: #ff9900; } + + +/* Areas in the navigation table */ + +.breadcrumbNav, +.breadcrumbNav a:link, .breadcrumbNav a:visited { + color: #006699; +} +.breadcrumbNav a:link, .breadcrumbNav a:visited { + text-decoration: underline; +} +.breadcrumbNav { + margin: 0.0em; + padding: 0.0em; + text-align: left; + font-weight: bold; +} +.breadcrumbNav .separator { + color: #ff9900; +} + +.DocSetBox { + background-image: none; + background-color: #006699; /* Symbian Blue */ + /* color: #aaccee; */ /* Lightish blue */ + color: #ffffff; +} + +.DocSetBox p { + font-family: meta, arial, sans-serif; + font-size: 12px; + font-weight: bold; + margin-left: 0.5em; +} + +.LogoBox { border-bottom: solid #ff9900 2px; } + +.DocSetBox p a:link, +.DocSetBox p a:visited +{ + color: white; + text-decoration: none; +} + +.DocSetBottomBox { + background-image: none; + background-color: white; + /* background-color: #b4daed; */ /* mid Blue of gradient.jpg */ + /* background-color: #f5fafe; */ /* Lightest Blue of gradient.jpg */ + /* background-color: #006699; */ /* Symbian Blue */ + color: #006699; /* Symbian blue */ + /* color: #aaccee; */ /* Lightish blue */ + /* color: #ffffff; */ /* white */ + /* border-bottom: solid #ff9900 2px; */ /* Red horizontal line at bottom */ +} + +.DocSetBottomBox p { + font-family: meta, arial, sans-serif; + font-size: 12px; + font-weight: bold; + margin-left: 0.5em; +} + +.DocSetBottomBox p a:link, +.DocSetBottomBox p a:visited +{ + color: white; + text-decoration: none; +} + +.ButtonBox { + background-color: white; /* contrast with dark-blue image text */ + color: black; /* for imageless people */ + /* + Background image must be defined separately in each file due to + widespread lack of standards compliance in UAs. + */ +} + +.ButtonBottomBox { + background-color: white; + /* background-color: #b4daed; */ /* mid Blue of gradient.jpg */ + /* background-color: white; */ /* contrast with dark-blue image text */ + color: black; /* for imageless people */ + /* border-bottom: solid #ff9900 2px; */ /* Red horizontal line at bottom */ + /* + Background image must be defined separately in each file due to + widespread lack of standards compliance in UAs. + */ +} + +.ButtonBox p, +.ButtonBottomBox p, +.DocSetBox p, +.DocSetBottomBox p +{ + margin-top: 0em; + margin-bottom: 0em; + padding-top: 1px; + padding-bottom: 1px; +} + + +.copyrightStatement { + font-size: 12px; +} + + +/* Ordinary items in the main area */ + +h1, h2, h3, h4, h5, h6 { + font-family: arial, lucida, helvetica, verdana, sans-serif; + font-weight: normal; + font-style: normal; + font-weight: bold; + color: #333333; + padding-left: 0.1em; +} + + +h1 { font-size: 180%; color: #000000;} /* Black */ +h2 { font-size: 140%; color: #006699;} /* Blue */ +h3 { font-size: 120%; } +h4 { font-size: 100%; padding-left: 0em; } +h5 { font-size: 100%; padding-left: 0em; } +h6 { font-size: 100%; padding-left: 0em; } + +.Title { text-align: left; font-weight: bold; font-size: 180%; } +.Author { text-align: right; font-style: italic;} +.Abstract { margin-left: 9%; margin-right: 2%; font-style: italic; font-size: 12pt; + font-family: arial, lucida, helvetica, verdana, + sans-serif; font-weight: normal;} +.Contents1 {margin-left: 3%; margin-right: 2%;}; +.Contents2 {margin-left: 9%; margin-right: 2%;}; +.Head1 { margin-left: 0%; } +.Head2 { margin-left: 3%; } +.Head3 { margin-left: 6%; } +.Bodytext { margin-left: 9%; margin-right: 2%; } + +code, pre, .CodeBlock, tt, kbd, samp { + font-family: courier new, courier, lucida console, + lucida typewriter, monospace; +} + + +/* Blocks of special information */ + +.Structure, .CodeBlock, .Prototype, .Instructions, .Process, .Concept, +.Guideline, .DataDescription, .Classification, .Example +{ + padding: 0.33em; + border: solid white 1px; /* Netscape 4.x workaround. */ + background-color: #dddddd; + display: block; + width: 100%; + margin-right: 1%; +} + + +.CodeBlock, +.Prototype +{ + border: solid white 1px; + background-color: #dddddd; +} + + +/* CodeBlocks in blue boxes want to be blue too. */ + +.Structure .CodeBlock, +.Instructions .CodeBlock, +.Process .CodeBlock, +.Concept .CodeBlock, +.Guideline .CodeBlock, +.DataDescription .CodeBlock, +.Classification .CodeBlock, +.Example .CodeBlock +{ + background-color: #cccccc; + border: solid #dddddd 1px; +} + + +/* Tables. It would be nice to have the cell and border colours adapt +to whatever the background colour is rather than just being grey. */ + +td.Cell { + background-color: white; + color: black; + text-align: left; +} + +th.Cell { + background-color: #eeeeee; + color: black; + text-align: left; + font-weight: bold; +} + +.TableWrap, .ValueTableWrap { + background-color: #aaaaaa; + color: white; +} + +/* Figures */ + +/* This was messing up IE5's tables... +.Figure { + margin-left: 5%; + margin-right: 5%; +} +*/ + +.Figure .Caption, .Figure .Image, .RelatedItems .Image { + text-align: center; +} + +.Caption { + font-style: italic; +} + + +/* Other */ + +.unresolvedLink { + color: #ff0000; + background-color: #ffddbb; +} + + +/* Glossary layout */ + +/* +.Glossary dd p, +.Glossary dd ul, +.Glossary dd ol +{ margin: 0.5em; } +*/ + +/* +.Glossary dd, +{ + margin-top: 1.0em; +} +*/ + +.Glossary dt { margin-top: 1.5em; } + diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/exampletemplate.html b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/exampletemplate.html new file mode 100644 index 00000000000..8847bc1e5b4 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/exampletemplate.html @@ -0,0 +1,103 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html><head> +<title>Example template in How to extend the user interface using templates</title> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="screen"> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="print"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css" media="screen"> + .ButtonBox { background-image: url(_stock/gradient.jpg); } + </style> + </head> + <body> + <table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr> + </tr><tr><td class="DocSetBox" width="25%"> + <p> </p> + </td> + <td class="ButtonBox" align="right" width="40%"> + <p><A href="../_index/index.html"></a> + <A href="Howtoregistertemplates.html"><IMG height=22 alt=[Previous] src="_stock/btn_prev_wt.gif" width=85 border=0 ></a> <A href="index.html"></a></p> + </td> + </tr></tbody></table> + <hr noshade size="1"> + <p class="breadcrumbNav"><span class="separator">»</span> + <A href="index.html">How to extend the user interface using templates</a> <span class="separator">»</span> Example template</p> + + <hr noshade size="1"> + <div class="AuthoredContent"> + + +</div><div class="Head1"> + +<h1>Example template</h1> +</div><div class="Bodytext"> +<p> +The following is an example template to create a simple Symbian OS +<code class="filename">EXE</code> project: +</p> +<p class="CodeBlock"><code><?xml version="1.0" encoding="ISO-8859-1"?><br><template type="ProjTempl" version="1.0" supplier="Symbian" revision="1.0" author="Bala Torati"<br> id="EXE" label="Simple EXE" description="A skeletal Symbian OS EXE project. Creates a folder for sources and another for include."<br> help="help.html"><br><br> <property-group id="basics" label="Basic Settings" description="Basic properties of a project" type="PAGES-ONLY" help="help.html"><br> <br><property id="uid2"<br> label="UID 2"<br> description="UID 2"<br> default="0x00000000"<br> type="input"<br> pattern="0x[0-9a-fA-F]{8}"<br> hidden="false"<br> mandatory="true"<br> persist="true"/><br> <br><property id="uid3"<br> label="UID 3"<br> description="UID 3"<br> default="0x00000000"<br> type="input"<br> pattern="0x[0-9a-fA-F]{8}"<br> hidden="false"<br> mandatory="false"<br> persist="true"/><br><br><property id="vid"<br> label="Vendor ID"<br> description="Vendor ID"<br> default="0x00000000"<br> type="input"<br> pattern="0x[0-9a-fA-F]{8}"<br> hidden="false"<br> mandatory="true"<br> persist="true"/><br><br><property id="author"<br> label="Author"<br> description="Name of the author"<br> type="input"<br> pattern=".*"<br> default=""<br> hidden="false"<br> persist="true"/><br><br><property id="copyright"<br> label="Copyright notice"<br> description="Your copyright notice"<br> type="input"<br> pattern=".*"<br> default="Your copyright notice"<br> hidden="false"<br> persist="true"/><br><br><property id="targetType"<br> label="Target Type"<br> description="Select the target type"<br> type="select"<br> hidden="false"<br> mandatory="true"<br> persist="true"><br> <item label="APP" selected="true" name="app"/><br> <item label="LIB" selected="false" name="lib"/><br> <item label="DLL" selected="false" name="dll"/><br> <item label="EXE" selected="false" name="exe"/><br> <item label="EXEDLL" selected="false" name="exedll"/><br> </property><br> </property-group><br><br> <property-group id="directories" label="Project Directories" description="Generated files will be copied to the specified directories under the project root directory" type="PAGES-ONLY" help="help.html"><br> <property id="incDir"<br> label="Include"<br> description="Directory for C++ header files"<br> type="input"<br> default="inc"<br> pattern="[a-zA-Z0-9]+"<br> mandatory="true"<br> persist="true"/><br><br> <property id="sourceDir"<br> label="Source"<br> description="Directory for C++ source files"<br> type="input"<br> default="src"<br> pattern="[a-zA-Z0-9]+"<br> mandatory="true"<br> persist="true"/><br> </property-group><br> <br> <process type="org.eclipse.cdt.templates.NewSymbianProject"><br> <simple name="name" value="$(projectName)"/><br> <simple name="targetType" value="$(targetType)"/><br> <simple name="uid2" value="$(uid2)"/><br> <simple name="uid3" value="$(uid3)"/><br> <simple name="vid" value="$(vid)"/><br> </process><br><br> <process type="org.eclipse.cdt.templateengine.CreateSourceFolder"><br> <simple name="projectName" value="$(projectName)"/><br> <simple name="path" value="$(sourceDir)"/><br> </process><br><br> <process type="org.eclipse.cdt.templateengine.CreateIncludeFolder"><br> <simple name="projectName" value="$(projectName)"/><br> <simple name="path" value="$(incDir)"/><br> </process><br><br> <process type="org.eclipse.cdt.templateengine.AddFiles"><br> <simple name="projectName" value="$(projectName)"/><br> <complex-array name="files"><br> <element><br> <simple name="source" value="inc/Basename.h"/><br> <simple name="target" value="$(incDir)/$(baseName).h"/><br> <simple name="replaceable" value="true"/><br> </element><br> <element><br> <simple name="source" value="src/Basename.cpp"/><br> <simple name="target" value="$(sourceDir)/$(baseName).cpp"/><br> <simple name="replaceable" value="true"/><br> </element><br> </complex-array><br> </process><br><br> <process type="org.eclipse.cdt.templateengine.AppendToMBSStringListOptionValues"><br> <simple +name="projectName" value= "$(projectName)"/> <br> <complex-array name="resourcePaths"><br> <element><br> <simple name="id" value=".*linker\.libraries\.libraries.*" /><br> <simple-array name="values"><br> <element value="euser.lib" /><br> </simple-array><br> <simple name="path" value="" /><br> </element><br> </complex-array><br> </process><br></template></code></p> +<p> +The above given template copies the following source (<code class="filename">.cpp</code>) +and header (<code class="filename">.h</code>) files in the <code>src</code> and <code>inc</code> +folders respectively. These files uses a set of macros to get the values +specified by the developer for file name, author name, copyright etc. +</p> +<p class="CodeBlock"><code>/*<br>============================================================================<br> Name : $(baseName).cpp<br> Author : $(author)<br> Version :<br> Copyright : $(copyright)<br> Description : Exe source file<br>============================================================================<br>*/<br><br>// Include Files <br><br>#include "$(baseName).h"<br>#include <e32base.h><br>#include <e32std.h><br>#include <e32cons.h> // Console<br><br><br>// Constants<br><br>_LIT(KTextConsoleTitle, "Console");<br>_LIT(KTextFailed, " failed, leave code = %d");<br>_LIT(KTextPressAnyKey, " [press any key]\n");<br><br><br>// Global Variables<br><br>LOCAL_D CConsoleBase* console; // write all messages to this<br><br><br>// Local Functions<br><br>LOCAL_C void MainL(const TDesC& aArgs)<br> {<br> //<br> // add your program code here, example code below<br> //<br> console->Write(_L("Hello, world!\n"));<br> console->Printf(_L("Command line args: \"%S\"\n"), &aArgs);<br> }<br><br><br>LOCAL_C void DoStartL()<br> {<br> // Create active scheduler (to run active objects)<br> CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();<br> CleanupStack::PushL(scheduler);<br> CActiveScheduler::Install(scheduler);<br><br> // Call main function with command line<br> TBuf<256> cmdLine;<br> RProcess().CommandLine(cmdLine);<br> MainL(cmdLine);<br><br> // Delete active scheduler<br> CleanupStack::PopAndDestroy(scheduler);<br> }<br><br><br>// Global Functions<br><br>GLDEF_C TInt E32Main()<br> {<br> // Create cleanup stack<br> __UHEAP_MARK;<br> CTrapCleanup* cleanup = CTrapCleanup::New();<br><br> // Create output console<br> TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)));<br> if (createError)<br> return createError;<br><br> // Run application code inside TRAP harness, wait keypress when terminated<br> TRAPD(mainError, DoStartL());<br> if (mainError)<br> console->Printf(KTextFailed, mainError);<br> console->Printf(KTextPressAnyKey);<br> console->Getch();<br> <br> delete console;<br> delete cleanup;<br> __UHEAP_MARKEND;<br> return KErrNone;<br> }</code></p> +<p class="CodeBlock"><code>/*<br>============================================================================<br> Name : $(baseName).h<br> Author : $(author)<br> Version :<br> Copyright : $(copyright)<br> Description : Exe header file<br>============================================================================<br>*/<br><br>#ifndef __$(baseName)_H__<br>#define __$(baseName)_H__<br><br><br>// Include Files<br><br>#include <e32base.h><br><br><br>// Function Prototypes<br><br>GLDEF_C TInt E32Main();<br><br><br>#endif // __$(baseName)_H__</code></p> +<p> +When the developer chooses the above template in the New Project wizard, +the following wizard pages are generated: +</p> +<div class="Figure"> + <p class="Image"><a name="Basic Settings"><IMG alt="Basic Settings" src="_stock/basicsettings.gif" border=0></a></p> +<p class="Caption"> +Basic Settings +</p> +</div> +<div class="Figure"> + <p class="Image"><a name="Project Directories"><IMG alt="Project Directories" src="_stock/projectdirectories.gif" border=0></a></p> +<p class="Caption"> +Project Directories +</p> +</div> +<p> +The input fields listed in the above given pages are as per the +definitions given in the template. In the template, the +<code>property-group</code> element with the ID "basics" defines all the input +fields required for the <code class="ProgramOutput">Basic Settings</code> page. While the +<code class="ProgramOutput">property-group</code> element with the ID "directories" defines all +the input fields required for the <code class="ProgramOutput">Project Directories</code> page. +</p> +<p> +The template will create a Symbian OS <code class="filename">EXE</code> project in the +Eclipse workspace with all the required resources. +</p> +<p> +The following <code class="ProgramOutput">C/C++ Projects</code> view shows the resources +created by the New Project wizard for the above given template: +</p> +<div class="Figure"> + <p class="Image"><a name="Explorer view"><IMG alt="Explorer view" src="_stock/explorerview.gif" border=0></a></p> +<p class="Caption"> +Explorer view +</p> +</div> + + </div><div class="Footer"> + <hr noshade size="1"> + <table cellpadding="0" cellspacing="0" border="0" width="100%"> + <tr> + <td class="ButtonBottomBox" align="right" height="12" width="67%"> + <p> + <A href="Howtoregistertemplates.html"><IMG height=22 alt=[Previous] src="_stock/btn_prev.gif" width=85 border=0></a> + <A href="#_top"><IMG height=22 alt=[Top] src="_stock/btn_top.gif" width=51 align=bottom border=0 ></a> + <A href="index.html"></a> + </p> + </td> + </tr> + </table> + </div> + </body> + </html> + diff --git a/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/index.html b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/index.html new file mode 100644 index 00000000000..0365ab72bd1 --- /dev/null +++ b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/index.html @@ -0,0 +1,57 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html><head> +<title>How to extend the user interface using templates</title> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="screen"> +<link href="_stock/sysdoc.css" type="text/css" rel="stylesheet" media="print"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <style type="text/css" media="screen"> + .ButtonBox { background-image: url(_stock/gradient.jpg); } + </style> + </head> + <body> + <table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr> + </tr><tr><td class="DocSetBox" width="25%"> + <p> </p> + </td> + <td class="ButtonBox" align="right" width="40%"> + <p> <A href="Howtodeveloptemplates.html#howto%2edevelop%2etemplates"><IMG height=22 alt=[Next] src="_stock/btn_next_wt.gif" width=58 border=0 ></a></p> + </td> + </tr></tbody></table> + <div class="AuthoredContent"> + +</div><div class="Head1"> + +<h1>How to add project templates to CDT</h1> +</div><div class="Bodytext"> +<p> +CDT 4.0 has a framework and extension points for allowing the contribution of project templates. Project templates +are used by the New Project Wizard to generate projects which are automatically populated with source files or settings. +The particular source files or settings can be dependent on information the user enters into the wizard. +</p> +<p> +The two main parts to integrating a template are writing the template itself (in XML format), and adding this to +a plug-in which extends the appropriate extension point. +</p> +<ul> +<li><A href="Howtodeveloptemplates.html#howto%2edevelop%2etemplates">How to develop templates</a> +<li><A href="Howtoregistertemplates.html#Howto%2eregister%2etemplates">How to register a template with Eclipse</a> +<li><A href="exampletemplate.html#Corona%2ecustomguide%2eexampletemplate">An example template</a></li> +</ul> + + </div><div class="Footer"> + <hr noshade size="1"> + <table cellpadding="0" cellspacing="0" border="0" width="100%"> + <tr> + <td class="ButtonBottomBox" align="right" height="12" width="67%"> + <p> + <A href="#_top"><IMG alt=[Top] src="_stock/btn_top.gif" width=51 align=bottom border=0></a> + <A href="Howtodeveloptemplates.html#howto%2edevelop%2etemplates"><IMG height=22 alt=[Next] src="_stock/btn_next.gif" width=58 border=0></a> + </p> + </td> + </tr> + </table> + </div> + </body> + </html> + diff --git a/doc/org.eclipse.cdt.doc.isv/topics_Guide.xml b/doc/org.eclipse.cdt.doc.isv/topics_Guide.xml index c6e41ba2ec3..81b595bbd3b 100644 --- a/doc/org.eclipse.cdt.doc.isv/topics_Guide.xml +++ b/doc/org.eclipse.cdt.doc.isv/topics_Guide.xml @@ -6,4 +6,5 @@ <toc label="Guide"> <topic label="CDT DOM" href="guide/dom/index.html"/> <topic label="Managed Build System Extensibility Document" href="guide/mbs/extensibilityGuide/Managed_Build_Extensibility.html"/> + <topic label="Project Template Engine" href="guide/projectTemplateEngine/index.html"/> </toc> |