Creating code templates

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

To create a new code template:

  1. From the main menu, click Window > Preferences.
  2. From the navigation tree, expand EGL > Editor and click Templates.
  3. In the Preferences window, click New.
  4. In the New Template window, specify both a name and a description identify the template. When you want to use the new template, you will type all or the beginning of the name and then activate content assist. For more information about naming considerations, see "Code templates."
  5. In the Pattern field, type the template:
    • Type any text 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 (}):
        ${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. To create the template, click OK.
  7. To save your changes, click Apply.
  8. To close the window, click OK.

Feedback