#
Editor Template

###### Identifier:

org.eclipse.ui.editors.templates

###### Since:

3.0

###### Description:

Templates are snippets of text or code which help the user enter reoccurring patterns into a text editor. Templates may contain variables which are resolved in the context where the template is inserted.

###### Configuration Markup:

<!ELEMENT extension (template* , resolver* , contextType* , include*)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

<!ELEMENT contextType EMPTY>

<!ATTLIST contextType

id CDATA #REQUIRED

class CDATA #REQUIRED

name CDATA #IMPLIED>

A context type defines a context within which templates are evaluated. A context type uses its resolvers to resolve a template.

- id - Unambiguously identifies this context type. Use of a qualified name is recommended.
- class - A subclass of `org.eclipse.jface.text.templates.TemplateContextType`.
- name - The display name of this context.

<!ELEMENT resolver EMPTY>

<!ATTLIST resolver

contextTypeId CDATA #REQUIRED

type CDATA #REQUIRED

class CDATA #REQUIRED

description CDATA #IMPLIED

name CDATA #IMPLIED

icon CDATA #IMPLIED>

A template variable resolver can resolve a template variable in a certain context.

- contextTypeId - References the context type that this resolver is contributed to.
- type - The type of this variable resolver. This property will be set on the resolver once it gets created.
- class - A subclass of `org.eclipse.jface.text.templates.TemplateVariableResolver`.
- description - The description of this variable resolver. This property will be set on the resolver once it gets created.
- name - The display name of this resolver.
- icon - An icon that may be displayed in the user interface.

<!ELEMENT template (pattern)>

<!ATTLIST template

id CDATA #REQUIRED

contextTypeId CDATA #REQUIRED

name CDATA #REQUIRED

description CDATA #IMPLIED

icon CDATA #IMPLIED>

A template is a snippet of code or text that will be evaluated in a given context. Variables which will be resolved in that context can be specified using the `${variable_type}` notation.

- id - Unambiguously identifies this template. Use of a qualified name is recommended.
- contextTypeId - References the context type that this template is contributed to.
- name - The internationalizable name of the template which will show up in the UI, such as in template proposals.
- description - The description of this template.
- icon - An icon that may be displayed in the UI for this template, for example in content assist proposals.

<!ELEMENT pattern (#PCDATA)>

The template pattern.

<!ELEMENT include EMPTY>

<!ATTLIST include

file CDATA #REQUIRED

translations CDATA #IMPLIED>

A collection of templates encoded as XML can be included as a whole via this element.

- file - The XML file to import templates from.
- translations - An optional properties file with resources for the templates specified in `file`.

###### Examples:

       <extension
             point="org.eclipse.ui.editors.templates">
          <template
             name="%ant.tasks.javac.name"
             contextTypeId="org.eclipse.ui.examples.templateeditor.antcontext"
             id="org.eclipse.ui.examples.templateeditor.templates.javac"
             description="%ant.tasks.javac.description">
              <pattern>
                 <javac srcdir="${src}"
                   destdir="${dst}"
                   classpath="${classpath}"
                   debug="${debug}"/>
              </pattern>
          </template>

          <resolver
             contextTypeId="org.eclipse.ui.examples.templateeditor.antcontext"
             type="src"
             class="org.eclipse.ui.examples.templateeditor.editors.AntVariableResolver">
          </resolver>

          <resolver
             contextTypeId="org.eclipse.ui.examples.templateeditor.antcontext"
             type="dst"
             class="org.eclipse.ui.examples.templateeditor.editors.AntVariableResolver">
          </resolver>
       </extension>

###### API Information:

See the `org.eclipse.jface.text.templates` package in the `org.eclipse.text` plug-in for the relevant API.

###### Supplied Implementation:

See the `org.eclipse.jface.text.templates` package in the `org.eclipse.text` plug-in for the relevant classes.

Copyright (c) 2001, 2004 IBM Corporation 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