Code Templates View
The Code Templates is located near the Navigator and Hierarchy views or you can open it from Window > Show View > Other… > DVT > Code Templates.
To insert a template in a code editor, you can either:
drag and drop it in the editor at a specific location
double click on it
click on Insert into editor button
right-click on it > Insert
Note
If you choose one of the last three actions mentioned above, the template will be inserted in the current editor at the current cursor’s positon. Please make sure you have an opened editor and the cursor is at the right position before adding the template!
Insert the selected template into the current editor
Create a new template
Edit the selected template
Remove the selected template (NOTE: you cannot undo this operation!)
Refresh the view (if it doesn’t automatically update when you modify templates/projects etc.)
Collapse/expand all
Filter templates (you can filter them by: nature, context, name, project, description)
Templates’ natures
Templates’ contexts
Preview the template’s pattern (it automatically updates when clicking on a template)
To create a new template, click on Create a New Template button on the toolbar:
Template’s name
Check Automatically insert if you want the template to expand automatically on Ctrl+Space when there is no other matching template available. It is usually good idea to leave the checkbox checked, otherwise you would get a template proposal “popup”
Each template must be created under a project available in the current workspace (select [ global ] for a global template)
Assign a nature - only natures relevant to the selected project will be displayed
Template’s context - only contexts relevant to the selected nature will be displayed
Templates’s description
Code Pattern - embed variables in ${} e.g. ${variable_name} to enable the template proposal wizard when inserting the template into an editor
Insert variables - here you can find some useful misc. predefined variables