Creating code templates

You can create your own code template. After the template is created it is shown in the list of templates.

To create a new code template, follow these steps:

  1. From the main menu, click Window > Preferences.
  2. From the navigation tree, expand EGL > Editor and then click Templates.
  3. From the Preferences window, click New.
  4. In the New Template window, specify both a name and a description to uniquely identify the template. When you want to use the new template, you will type all or the beginning of the name and then activate code assist. For more information on naming considerations, see Code templates.
  5. In the Pattern field, type the template itself:
    • Type any text that you want to display.
    • To place an existing variable at the current cursor position, click Insert Variable, then double-click a variable. When you insert the template in the EGL editor, each of those variables resolves to the appropriate value.
    • To create a custom variable, type a dollar sign ($) followed by a left brace ({), a string, and a right brace (}), as in this example:
        ${variable}

      You might find it easier to insert an existing variable and change the name for your own use.

      When you insert a custom template in the EGL editor, each variable is highlighted to indicate that a value is required.

    • You can select an area of functionality for the template from the Context list, but user-defined templates are not filtered by capability like the default templates are. For user-defined templates, this value is for informational purposes only.
  6. Click OK to create the template.
  7. To save your changes, click Apply.
  8. Click OK to close the window.

Feedback