Additional automatic features

Xtext makes use of the index to automatically provide many additional IDE features for your DSL. Some examples are shown in the next screenshot. For example, you can mark occurrences of any named element by toggling the corresponding toolbar button. In the following screenshot, it is the one right on top of the Plug-in Development perspective button, marked with (1). The markers will be evident both in the editor and in its right-hand side ruler. This feature is based on the IResourceDescription instances stored in the index; they contain information about cross-references, possibly to other resources. Furthermore, by right-clicking on an element in the editor, you can choose the menu References, and in the Search view, you can see all the files in your project that reference the selected element. In the following screenshot, we selected the method predicate in the file example.smalljava, and the view shows all its occurrences also in the other file example2.smalljava:

Additional automatic features

The editor for your DSL automatically supports refactoring of names: just select an element with a name, right-click on it, and choose Rename Element. This refactoring has the same user interface as the one of JDT; you can also access the refactoring dialog so that you can have a preview of what will be modified and possibly deselect some modifications. Refactoring works across multiple files as well. References in the same file are updated while you rename the element. External references will be updated after pressing Enter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.53.209