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 @@ + + +How to develop templates in How to extend the user interface using templates + + + + + + + + + +
+

 

+
+

[Previous] [Next]

+
+
+ + +
+
+ + +
+ +

How to develop templates

+
+

+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 +EXE application for a set of Build Configurations. +

+

+The project templates are simple XML files, which follow a structure or +schema defined in the TemplateDescriptorSchema.xsd 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. +

+

+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. +

+

+This document details the schema for writing project templates. The +schema file TemplateDescriptorSchema.xsd, which defines the +structure for the project templates, is part of +org.eclipse.cdt.templateengine plug-in. +

+

+The structure or schema for a project template is as follows: +

+

<template
type="TemplateType"
version="Version"
supplier="Supplier"
revision="Revision"
author="Author"   
id="TemplateId"
label="Template label visible to the user"
description="A brief description of the template"
help="help.html"
preview-icon="icon.gif">

<property-group
id="properyGroupId"
label="Property group label"
description="A simple description of the property group"
type=" Type of UIElement group"
help="help.html"
branding-icon="icon.gif">
...
</property-group>

<process>
...
</process>

</template>

+

+The root element for a project template is template, which +provides the following properties or attributes to describe the template: +

+ +

+The template element includes the following child elements: +

+ +

+property-group +

+

+As mentioned earlier, a property-group includes the +property elements that specify all the input fields required for a +wizard page. A property-group can include any number of +property elements. The following attributes can be used to +describe a property group: +

+ +

+property +

+

+The syntax for the property elements included by the +property-group element is as follows: +

+

<property
id="propertyId"
label="User visible label of the property"
description="A brief description of the property"
type="type of the property"
pattern="Regular expression of the expected property"
default="Default value of the property"
size="size"
mandatory="true|false"
hidden="true|false"
persist="true|false">

     <item
     name="name of the item"
     label="User visible label of the item"
     selected="true|false">
     ...
     </item>
</property>

+

+Here is a list of attributes of the property element: +

+ +

+If the property type is select or +stringlist, you can include the item 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 item element: +

+

<item
name="name of the item"
label="User visible label of the item"
selected="true|false">
</item>

+

+Here is a list of attributes of the item element: +

+ +

+process +

+

+The process 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: +

+

<process type="org.eclipse.cdt.templateengine.<process type>">
    <simple name="name" value=""/>

    <complex name="name">
        ...
    </complex>

    <simple-array name="values">
        ...
    </simple-array>

    <complex-array name="name">
        ...
    </complex-array>

</process>

+

+A process element defines a single process. A process is +like a procedure with a set of parameters. In similar terms, the +process 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. +

+

+You can specify the process type using the type attribute. +For example, to add files to a project you can use +org.eclipse.cdt.templateengine.AddFiles as the process type. +

+

+A process element may include the following child elements: +

+ +

+Process types +

+

+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. +

+

+The Template Engine plug-in provides a set of process types using the +extension-point org.eclipse.cdt.templateengine.processType. 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. +

+

+The following is a list of process types provided by the Template Engine: +

+ +

+Once the project template has been written, register it with Eclipse to +make it available for use. For more information on this, refer to +How to register a template with Eclipse. +

+ +
+
+

See also:

+
+ + +
+ + + 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 @@ + + +How to register a template with Eclipse in How to extend the user interface using templates + + + + + + + + + +
+

 

+
+

[Previous] [Next]

+
+
+ + +
+
+ + +
+ +

How to register a template with Eclipse

+
+

+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". +

+

+To register a project template with Eclipse follow the steps given below: +

+
    +
  1. +

    +Create an empty plug-in project from the Eclipse workbench without +the source folders. +

    +
  2. +

    +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. +

    +
  3. +

    +Open the plug-in manifest editor and select the +Dependencies page. For more information on plug-in manifest +editor, refer to PDE + Guide > Getting Started > Basic Plug-in Tutorial +> Plug-in manifest editor. +

    +
  4. +

    +Click Add to select +org.eclipse.cdt.templateengine plug-in from the list. +

    +
  5. +

    +Select the Extensions page in the plug-in manifest +editor. +

    +
  6. +

    +Click Add to create an extension to the extension-point. +

    +
  7. +

    +Select the extension-point with ID +org.eclipse.cdt.templateengine.templates from the list of +extensions-points. +

    +
  8. +

    +Right-click on the newly added extension, and select +New > +template from the context menu. +

    +
  9. +

    +Choose the new template added in step 6 from the All +Extensions list. +

    +
  10. +

    +Specify the wizardId attribute of the template as +"org.eclipse.cdt.project.ui.NewProjectWizard". This +attribute is mandatory. +

    +
  11. +

    +Specify the location of the template relative to the plug-in created +in step 1. This attribute is mandatory. +

    +
  12. +

    +Specify a filterPattern 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 "|" . +

    +

    +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. +

    +

    +For more information on regular expression patterns, refer to Java +API document for +java.util.regex.Pattern. +

    +
  13. +

    +Select an appropriate project type from the +projectType drop-down list. This is an optional attribute. +

    +
  14. +

    +Specify the usageDescription, 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 +java.util.regex.Pattern. +

    +

    +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 C++ Application for Symbian OS, the wizard +will list all the templates with the relevant +usageDescription. Otherwise, for a standard CDT +C++ Project the wizard will list all the templates, irrespective of +whether the usageDescription is specified or not. +

    +
  15. +

    +Specify the pagesAfterTemplateSelectionProvider, +which is a fully qualified name of the class that implements +org.eclipse.cdt.templateengine.IPagesAfterTemplateSelectionProvider +interface. This is an optional attribute. +

    +
  16. +
+

+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. +

+ +
+
+

See also:

+
+ + +
+ + + 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 new file mode 100644 index 00000000000..3fc958e352b Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up.gif differ 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 new file mode 100644 index 00000000000..44419165c40 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/arrow_up_2.gif differ 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 new file mode 100644 index 00000000000..aec95acf512 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/basicsettings.gif differ 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 new file mode 100644 index 00000000000..045254173fe Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next.gif differ 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 new file mode 100644 index 00000000000..ffe4e24c784 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_next_wt.gif differ 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 new file mode 100644 index 00000000000..dfb39c574a0 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev.gif differ 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 new file mode 100644 index 00000000000..88fbefb3dd3 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_prev_wt.gif differ 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 new file mode 100644 index 00000000000..fe1b1528e33 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/btn_top.gif differ 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 new file mode 100644 index 00000000000..d782980b3a5 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/explorerview.gif differ 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 new file mode 100644 index 00000000000..ffff5f6689f Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/gradient.jpg differ 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 new file mode 100644 index 00000000000..4b2503b70e0 Binary files /dev/null and b/doc/org.eclipse.cdt.doc.isv/guide/projectTemplateEngine/_stock/projectdirectories.gif differ 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 @@ + + +Example template in How to extend the user interface using templates + + + + + + + + + +
+

 

+
+

   + [Previous]

+
+
+ + +
+
+ + +
+ +

Example template

+
+

+The following is an example template to create a simple Symbian OS +EXE project: +

+

<?xml version="1.0" encoding="ISO-8859-1"?>
<template type="ProjTempl" version="1.0" supplier="Symbian" revision="1.0" author="Bala Torati"
        id="EXE" label="Simple EXE" description="A skeletal Symbian OS EXE project. Creates a folder for sources and another for include."
         help="help.html">

    <property-group id="basics" label="Basic Settings" description="Basic properties of a project" type="PAGES-ONLY" help="help.html">
        
<property id="uid2"
            label="UID 2"
            description="UID 2"
            default="0x00000000"
            type="input"
            pattern="0x[0-9a-fA-F]{8}"
            hidden="false"
            mandatory="true"
            persist="true"/>
        
<property id="uid3"
            label="UID 3"
            description="UID 3"
            default="0x00000000"
            type="input"
            pattern="0x[0-9a-fA-F]{8}"
            hidden="false"
            mandatory="false"
            persist="true"/>

<property id="vid"
            label="Vendor ID"
            description="Vendor ID"
            default="0x00000000"
            type="input"
            pattern="0x[0-9a-fA-F]{8}"
            hidden="false"
            mandatory="true"
            persist="true"/>

<property id="author"
            label="Author"
            description="Name of the author"
            type="input"
            pattern=".*"
            default=""
            hidden="false"
            persist="true"/>

<property id="copyright"
            label="Copyright notice"
            description="Your copyright notice"
            type="input"
            pattern=".*"
            default="Your copyright notice"
            hidden="false"
            persist="true"/>

<property id="targetType"
            label="Target Type"
            description="Select the target type"
            type="select"
            hidden="false"
            mandatory="true"
            persist="true">
            <item label="APP" selected="true" name="app"/>
            <item label="LIB" selected="false" name="lib"/>
            <item label="DLL" selected="false" name="dll"/>
            <item label="EXE" selected="false" name="exe"/>
            <item label="EXEDLL" selected="false" name="exedll"/>
        </property>
    </property-group>

    <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">
    <property id="incDir"
                label="Include"
                description="Directory for C++ header files"
                type="input"
        default="inc"
                pattern="[a-zA-Z0-9]+"
                mandatory="true"
                persist="true"/>

    <property id="sourceDir"
                label="Source"
                description="Directory for C++ source files"
                type="input"
                default="src"
                pattern="[a-zA-Z0-9]+"
                mandatory="true"
                persist="true"/>
    </property-group>
    
    <process type="org.eclipse.cdt.templates.NewSymbianProject">
        <simple name="name" value="$(projectName)"/>
        <simple name="targetType" value="$(targetType)"/>
        <simple name="uid2" value="$(uid2)"/>
        <simple name="uid3" value="$(uid3)"/>
        <simple name="vid" value="$(vid)"/>
    </process>

    <process type="org.eclipse.cdt.templateengine.CreateSourceFolder">
        <simple name="projectName" value="$(projectName)"/>
        <simple name="path" value="$(sourceDir)"/>
    </process>

    <process type="org.eclipse.cdt.templateengine.CreateIncludeFolder">
        <simple name="projectName" value="$(projectName)"/>
        <simple name="path" value="$(incDir)"/>
    </process>

    <process type="org.eclipse.cdt.templateengine.AddFiles">
        <simple name="projectName" value="$(projectName)"/>
        <complex-array name="files">
            <element>
                <simple name="source" value="inc/Basename.h"/>
                <simple name="target" value="$(incDir)/$(baseName).h"/>
                <simple name="replaceable" value="true"/>
            </element>
            <element>
                <simple name="source" value="src/Basename.cpp"/>
                <simple name="target" value="$(sourceDir)/$(baseName).cpp"/>
                <simple name="replaceable" value="true"/>
            </element>
        </complex-array>
    </process>

    <process type="org.eclipse.cdt.templateengine.AppendToMBSStringListOptionValues">
        <simple +name="projectName" value= "$(projectName)"/>      
        <complex-array name="resourcePaths">
            <element>
                <simple name="id" value=".*linker\.libraries\.libraries.*" />
                <simple-array name="values">
                    <element value="euser.lib" />
                </simple-array>
                <simple name="path" value="" />
            </element>
        </complex-array>
    </process>
</template>

+

+The above given template copies the following source (.cpp) +and header (.h) files in the src and inc +folders respectively. These files uses a set of macros to get the values +specified by the developer for file name, author name, copyright etc. +

+

/*
============================================================================
 Name : $(baseName).cpp
 Author : $(author)
 Version :
 Copyright : $(copyright)
 Description : Exe source file
============================================================================
*/

// Include Files

#include "$(baseName).h"
#include <e32base.h>
#include <e32std.h>
#include <e32cons.h> // Console


// Constants

_LIT(KTextConsoleTitle, "Console");
_LIT(KTextFailed, " failed, leave code = %d");
_LIT(KTextPressAnyKey, " [press any key]\n");


// Global Variables

LOCAL_D CConsoleBase* console; // write all messages to this


// Local Functions

LOCAL_C void MainL(const TDesC& aArgs)
    {
    //
    // add your program code here, example code below
    //
    console->Write(_L("Hello, world!\n"));
    console->Printf(_L("Command line args: \"%S\"\n"), &aArgs);
    }


LOCAL_C void DoStartL()
    {
    // Create active scheduler (to run active objects)
    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);

    // Call main function with command line
    TBuf<256> cmdLine;
    RProcess().CommandLine(cmdLine);
    MainL(cmdLine);

    // Delete active scheduler
    CleanupStack::PopAndDestroy(scheduler);
    }


// Global Functions

GLDEF_C TInt E32Main()
    {
    // Create cleanup stack
    __UHEAP_MARK;
    CTrapCleanup* cleanup = CTrapCleanup::New();

    // Create output console
    TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)));
    if (createError)
        return createError;

    // Run application code inside TRAP harness, wait keypress when terminated
    TRAPD(mainError, DoStartL());
    if (mainError)
        console->Printf(KTextFailed, mainError);
    console->Printf(KTextPressAnyKey);
    console->Getch();
    
    delete console;
    delete cleanup;
    __UHEAP_MARKEND;
    return KErrNone;
    }

+

/*
============================================================================
 Name : $(baseName).h
 Author : $(author)
 Version :
 Copyright : $(copyright)
 Description : Exe header file
============================================================================
*/

#ifndef __$(baseName)_H__
#define __$(baseName)_H__


// Include Files

#include <e32base.h>


// Function Prototypes

GLDEF_C TInt E32Main();


#endif // __$(baseName)_H__

+

+When the developer chooses the above template in the New Project wizard, +the following wizard pages are generated: +

+
+

Basic Settings

+

+Basic Settings +

+
+
+

Project Directories

+

+Project Directories +

+
+

+The input fields listed in the above given pages are as per the +definitions given in the template. In the template, the +property-group element with the ID "basics" defines all the input +fields required for the Basic Settings page. While the +property-group element with the ID "directories" defines all +the input fields required for the Project Directories page. +

+

+The template will create a Symbian OS EXE project in the +Eclipse workspace with all the required resources. +

+

+The following C/C++ Projects view shows the resources +created by the New Project wizard for the above given template: +

+
+

Explorer view

+

+Explorer view +

+
+ +
+ + + 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 @@ + + +How to extend the user interface using templates + + + + + + + + + +
+

 

+
+

[Next]

+
+
+ +
+ +

How to add project templates to CDT

+
+

+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. +

+

+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. +

+ + +
+ + + 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 @@ +