From 90b276e9c0625ceeddebed7776776c836ba8d49f Mon Sep 17 00:00:00 2001 From: Andrew Ferguson Date: Mon, 17 Sep 2007 14:17:15 +0000 Subject: [PATCH] 203553: Apply patch plus additional docs improvements on behalf on Beth Tibbitts. Remove unused usageDescription attribute. --- .../schema/templates.exsd | 70 ++++++++----------- .../core/templateengine/TemplateEngine.java | 18 +++-- .../cdt/core/templateengine/TemplateInfo.java | 11 +-- .../Howtoregistertemplates.html | 56 ++++++--------- 4 files changed, 59 insertions(+), 96 deletions(-) diff --git a/core/org.eclipse.cdt.core/schema/templates.exsd b/core/org.eclipse.cdt.core/schema/templates.exsd index b2a62c32360..8bb637eece8 100644 --- a/core/org.eclipse.cdt.core/schema/templates.exsd +++ b/core/org.eclipse.cdt.core/schema/templates.exsd @@ -6,14 +6,14 @@ - This templates extension point facilitates the users to contribute their Template XMLs to the Template Engine plugin. + This templates extension point facilitates the users to contribute their Template XMLs to the Template Engine plug-in. - Extension point added to Template Engine plugin. Any plugin, which intends to contribute XML templates to Temaplate Engine has to extend this extension point, and add template element. + Extension point added to Template Engine plugin. Any plugin, which intends to contribute XML templates to Template Engine has to extend this extension point, and add template element. @@ -57,30 +57,41 @@ + + + + A unique identifier for this template contribution. This does not need to be the same as the id of the template (as defined in template.xml) it is contributing. This allows contributing the same template.xml more than once (for example for multiple project types, or with alternate page sequences). + + + - The location of the template(relative within the extender plugin). -This is a must enter, attribute. + The path of template.xml (relative to the base of the containing plug-in). For example "templates/TemplateOne/template.xml". This attribute is mandatory. - + - Any filterPatter associated with this Template to be used by TemplateEngine. -This is an optional attribute. + This id refers to the cdt project type that the template will be associated with. Project types are contributed to the org.eclipse.cdt.managedbuilder.core.buildDefinitions extension-point. See the CDT Build System documentation in the developer guide for built-in project type ids. - + - 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. + If true this template contribution should appear as a folder. Defaults to false. + + + + + + + filterPattern is a java.util.regex.Pattern format string which is used to match against build configuration ids. This is an optional attribute, if absent will all configurations will match. @@ -94,27 +105,6 @@ This is an optional attribute. - - - - - - - - - - - - - - - - - - - - - @@ -147,17 +137,13 @@ This is an optional attribute. The following is an example of the extension point usage: <p> <pre> - <extension - id="simpleEXETemplateExample" - name="Simple EXE Template Example" - point="org.eclipse.cdt.templateengine.templates"> - <template - filterPattern=".*" - usageDescription="Simple EXE" - location="templates/org/eclipse/cdt/templates/projecttemplates/Simple EXE/template.xml" - projectType="org.eclipse.cdt.build.projectType.exe" - wizardId="org.eclipse.cdt.templates.ui.NewManagedProjectWizard"> - </template> + <extension point="org.eclipse.cdt.core.templates"> + <template + id="org.foobar.templates.MyExampleTemplate" + location="templates/MyExampleTemplate/template.xml" + projectType="org.eclipse.cdt.build.core.buildArtefactType.exe" + filterPattern=".*"> + </template> </extension> </pre> diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java index f73a9af070a..81d3eacf15e 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java @@ -111,7 +111,7 @@ public class TemplateEngine { } /** - * This method will be called by Contianer UIs (Wizard, PropertyPage, + * This method will be called by Container UIs (Wizard, PropertyPage, * PreferencePage). Create a Template instance, update the ValueStore, with * SharedDefaults. This method calls the getTemplate(URL), after getting URL * for the given String TemplateDescriptor. @@ -209,7 +209,6 @@ public class TemplateEngine { String pluginId = null; String projectType = null; String filterPattern = null; - String usage = null; boolean isCategory = false; String extraPagesProvider = null; @@ -217,14 +216,13 @@ public class TemplateEngine { for(int i=0; i*/()); } @@ -280,12 +278,12 @@ public class TemplateEngine { } /** - * Gets an array of template info objects matching the criteria passed as params. + * Gets an array of template info objects matching the criteria passed as parameters. * @param projectType may not be null * @param toolChain may be null to indicate no tool-chain * @param usageFilter a usage string which is matched against the filter from the template, may be null * to indicate no usage filtering - * @return an array of template infos (never null) + * @return an array of TemplateInfo objects (never null) */ public TemplateInfo[] getTemplateInfos(String projectType, String toolChain, String usageFilter) { List/**/ templateInfoList = (List/*
-

How to register a template with Eclipse

+

How to register a project template with CDT

Once the project template is ready, you need to register it with Eclipse @@ -40,7 +40,7 @@ group all the resources required for this application in a folder "HelloWorld".

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

  1. @@ -50,9 +50,9 @@ 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. +Create a new folder to contain the template project's content e.g. "MyExampleProject/templates/MyExampleTemplate". +Copy the project template.xml along with all the resources required to create the project. For example, all the +header files, source files, resource files etc.

  3. @@ -65,7 +65,9 @@ editor, refer to PDE

  4. Click Add to select -org.eclipse.cdt.templateengine plug-in from the list. +org.eclipse.cdt.core and +org.eclipse.cdt.ui +plug-ins from the list.

  5. @@ -79,29 +81,31 @@ Click Add to create an extension to the extension-point.

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

  7. Right-click on the newly added extension, and select New > template from the context menu. +The first one has already been added for you, "(template)".

  8. -Choose the new template added in step 6 from the All -Extensions list. +Select the new template added in the previous step from the All +Extensions list. Its name is initially "(template)".

  9. -Specify the wizardId attribute of the template as -"org.eclipse.cdt.project.ui.NewProjectWizard". This -attribute is mandatory. +Specify the id attribute of this template contribution, for example +"com.foobar.templates.contrib.MyTemplate1". This attribute is mandatory. The id need not be +the same as the template id (from template.xml). This allows contributing the same template.xml multiple +times. It will replace "(template)" in the list.

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

  11. @@ -127,31 +131,15 @@ API document for

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

    -
  13. -

    -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. +Specify the project type you wish the template to be associated with. The project type id can be +found by looking at the project types contributed to the buildDefinitions extension point. See the CDT Build System documentation in the developer guide for built-in project type ids. +projectType drop-down list. This is an mandatory attribute.

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