You can enable, disable, create, edit, export,
import, and remove code templates, and you can restore default code
templates.
You can set template preferences in the following ways:
- To limit the list of code templates that is offered to you in
the editor, you can enable or disable specific templates.
- You can create your own code template. After the template is created
it is shown in the list of templates.
- You can edit existing code templates to fit your specific coding
needs.
- If a code template you edited is one of the templates provided
with the product, you can revert to the original template.
- You can export code templates to a file system.
- You can import code templates from a file system.
- You can remove code templates from the list of available templates.
You can restore the templates if you have not exited the workbench.
After you exit the workbench, the removed templates cannot be restored.
- You can reset the code template list to the original list of templates
when the workbench was installed. When restoring the list of code
templates any modifications or templates you created will be removed.
To set EGL template preferences, do as follows:
- From the main menu, click . The Preferences window
is displayed.
- From the navigation tree, expand and then click Templates.
The Templates pane containing a list
of templates is displayed.
- You can perform the following tasks:
Task |
Steps |
Enable code templates in the EGL editor |
In the Templates pane, select the check
box to the left of a template name that you want to be available in
the EGL editor. |
Disable code templates in the EGL editor |
In the Templates pane, clear the check
box to the left of the template names that you do not want to show
in the EGL editor. |
Create a new code template |
- In the Templates pane, click New.
A New Template window is displayed.
- In the New Template pane, specify both a
name and a description to uniquely identify the template. When you
want to use the new template, type all or the beginning of the name
and then activate code assist.
- 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.
- Click OK to create the template.
|
Edit an existing code template |
- Select the desired template from the table and click Edit.
An Edit Template window is displayed.
- Change the desired fields in the Edit Template window.
When you are finished, click OK.
|
Revert to the original template |
Select
the desired template from the table and then click Revert
to Default. |
Export code templates |
- Select the desired templates from the table and click Export.
An Export Templates window is displayed.
Note: As
in other applications on Windows™ 2000/NT/XP,
you can click an entry to select it; can use Ctrl-click to
select or deselect an entry without affecting other selections; and
can use Shift-click to select a set of entries
that are contiguous to the entry you last clicked.
- In the Export Templates window, select the
location to save the template file. You can browse the various locations
to locate the place that you want to save the templates.
- Click Save to save the templates in the
specified location.
|
Import code templates |
- Click Import. An Import Templates window
is displayed.
- Select the location of the template file to be imported in the Import
Templates window. You can browse the various locations
to locate the template file that you want to import.
- Select the template file to be imported and click Open.
The templates are added to the existing templates.
|
Remove an existing code template |
In
the table, select the templates that you want to remove, and click Remove. |
Restore the default code templates |
To
return to the template list that was in effect at installation time,
click Restore Defaults. |
- To save the changes and remain in the Preferences window,
click Apply. To save the changes and exit the
window, click OK. To cancel the changes and
exit the window, click Cancel.