Editor Templates (Professional Edition only)

Templates are a structured description of coding patterns that reoccur in source code. The OCL editor supports the use of templates to fill in commonly used OCL Library patterns. Templates are inserted using content assist (Ctrl+Space).

For example, a common OCL Library pattern is a test definition. By using a template for this pattern, you can avoid typing in the complete code for the test. Invoking content assist will present you with a list of possible templates. You can choose the appropriate template by name (OCL Library: Tests - Template: OCL Library Tests section). Selecting this template will insert the code into the editor and position your cursor so that you can edit the details.

Templates can contain template variables. Variables mark the editable locations. They can be resolves to a concrete value when the template is evaluated in its context. They can also provide a list of alternative proposals valid at the given location.

Many common templates are already defined. These can be viewed with the OCL Editor > OCL Templates preference page. You can also create your own templates or edit the existing ones.

Related reference

Templates preferences