Example - Template Editor
The Template Editor example demonstrates how to add template support to an editor. The example is
based on the PDE example editor project that can be created using the new project wizard. The editor
is a simple XML editor; it is only for demonstration purposes.
The code for this example is in the
To explore the code it is recommended to import that plug-in into your workspace.
Features demonstrated in the template editor
creating a template context for an editor
setting up a content assist processor that will propose template completions
contributing a context type and variable resolvers to an editor via plugin.xml
contributing templates to a context type via plugin.xml
adding a preference page for handling templates, both contributed and user-added
Features not demonstrated
Running the example Template editor
Create a project
Create a file with the file extension ".xml" in the newly created project.
Close the editor that opened automatically
Select the new file in the Navigator and from the context menu select Open With > Template Editor to
open the Template example editor .
Code organization of the template editor example
The example code is organized in three packages:
org.eclipse.ui.examples.templateeditor.editors contains all the editor specific
XMLConfiguration to see how the
is added in the
org.eclipse.ui.examples.templateeditor.preferences contains the contributed template
org.eclipse.ui.examples.templateeditor.template contains the example context type, the
completion processor and the variable resolver that is contributed via plugin.xml.