Editors

Editors

The four editors are all generated using Xtext, and so exhibit similar behavior to other Eclipse editors.

The standard facilities are

The following facilities have partial functionality

The following facilities have little or no functionality

Syntax coloring

The editors use similar colors to JDT.

  • green for comments

  • bold purple for keywords

  • grey for numbers

  • blue for strings

Additionally

  • italics for text referencing a definition

References for which the name of the definition matches a keyword use italics in the same way as other cross references. Names of a definition matching a keyword use bold purple in the same way as keywords.

The syntax coloring may be changed using the Window->Preferences->OCL pages.

Validation

Syntax errors are detected and offending text is underlined with accompanying annotations and problem markers.

If there are no syntax errors, semantic validation is performed with similar feedback of problems. Semantic validation is not performed when there are syntax errors since a single syntax error may provoke many hundreds of semantic errors. These can make the original syntax error difficult to resolve.

The use of the well-formedness rules for a final validation of the Abstract Syntax is only partially implemented, since correction of the OCL in the OMG specifiucation is still work in progress.

By default, the Xtext nature is not added to projects using OCL editors and so no builder runs in the background creating problem markers for OCL files. This is generally beneficial when you have many files for which the over-enthusiastic rebuilds waste build time, or experimental files for which the many errors clutter the Problem View.

If your OCL is good quality, you may activate the Xtext nature and builder by selecting the project and then invoking Configure->Add Xtext Nature.

Hover Text

Hover text has been implemented to provide feedback on the usage and type of expression terms. For instance hovering over the size operation in the example below reveals that it is an Operation for the Loan specialization of Collection .

(Note that the Class specialization for Loan is incorrectly shown again as an Operation specialization.)

Content Assist

Typing Ctrl and Space activates the Content Assist pop-up to offer suggestions as to what might be typed to the right of the cursor.

Code Templates

Code templates are provided for many of the major constructs and some expression elements.

You may define your own templates. If you would like to contribute them, please raise a Bugzilla.

Open Declaration

It is possible to navigate to a definition provided an editor is already open for the definition.