# Template Extension point

###### Identifier:

org.eclipse.cdt.core.templates

###### Since:

CDT 4.0

###### Description:

This templates extension point facilitates the users to contribute their Template XMLs to the Template Engine plug-in.

###### Configuration Markup:

<!ELEMENT extension (template+ , category*)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

Extension point added to Template Engine plugin. Any plugin, which intends to contribute XML templates to the Template Engine must extend this extension point, and add the template element.

- id - Id for the extension in the extender plugin.
- name - Optional name attribute.

<!ELEMENT template (toolChain* , parentCategory*)>

<!ATTLIST template

id CDATA #REQUIRED

location CDATA #REQUIRED

projectType CDATA #IMPLIED

isCategory (true | false)

filterPattern CDATA #IMPLIED

pagesAfterTemplateSelectionProvider CDATA #IMPLIED>

By adding the templates extension point the users can contribute their Template XMLs to the Template Engine plugin.

- id - 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).
- location - The path of template.xml (relative to the base of the containing plug-in). For example "templates/TemplateOne/template.xml". This attribute is mandatory.
- projectType - This attribute is a project type id referring 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. This attribute is mandatory. CDT pre-defines the following values of the build artifact type property:
  - "org.eclipse.cdt.build.core.buildArtefactType.exe" - to represent executable
  - "org.eclipse.cdt.build.core.buildArtefactType.staticLib" - to represent static library
  - "org.eclipse.cdt.build.core.buildArtefactType.sharedLib" - to represent shared library
  - ISVs can define their own custom build artifact values by contributing to the org.eclipse.cdt.managedbuilder.core.buildProperties extension point.
  It's no longer manditory since templates are no longer organized by project type. Template catogories replace that functionality.
- isCategory - If true this template contribution should appear as a folder. Defaults to false.
- filterPattern - 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.
- pagesAfterTemplateSelectionProvider - A class that implements org.eclipse.cdt.templateengine.IPagesAfterTemplateSelectionProvider interface to create pages that will be appended to the pages returned from TemplatesChoiceWizard.getPagesAfterTemplateSelection().

<!ELEMENT toolChain EMPTY>

<!ATTLIST toolChain

id CDATA #REQUIRED>

This element is used to reference an existing toolchain by its unique identifier.

- id - The unique identifier of a toolchain contributed to the org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point.

<!ELEMENT category (parentCategory*)>

<!ATTLIST category

id CDATA #REQUIRED

label CDATA #REQUIRED>

Used to arrange templates in a hierarchy in the UI.

- id -
- label -

<!ELEMENT parentCategory EMPTY>

<!ATTLIST parentCategory

id CDATA #REQUIRED>

id of parent category.

- id -

###### Examples:

The following is an example of the extension point usage:

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

For more details on how to define your own templates, please check examples provided under `org.eclipse.cdt.ui.templateengine`

###### Supplied Implementation:

An implementation of this extension point is supplied in `org.eclipse.cdt.templateengine`

Copyright (c) 2007 Symbian Software Limited and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Symbian - Initial API and implementation