DVT e Language IDE User Guide
Rev. 24.1.15, 10 July 2024

11.4 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!'

  1. Insert the selected template into the current editor

  2. Create a new template

  3. Edit the selected template

  4. Remove the selected template ( NOTE: you cannot undo this operation!)

  5. Refresh the view (if it doesn't automatically update when you modify templates/projects etc.)

  6. Collapse/expand all

  7. Filter templates (you can filter them by: nature, context, name, project, description)

  8. Templates' natures

  9. A global template

  10. A project template

  11. Templates' contexts

  12. 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:

  1. Template's name

  2. 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"

  3. Each template must be created under a project available in the current workspace (select ['' ''global ] for a global template)

  4. Assign a nature - only natures relevant to the selected project will be displayed

  5. Template's context - only contexts relevant to the selected nature will be displayed

  6. Templates's description

  7. Code Pattern - embed variables in ${} e.g. ${ variable_name} to enable the template proposal wizard when inserting the template into an editor

  8. Insert variables - here you can find some useful misc. predefined variables