5.4. Visiting Declarations and BodiesΒΆ

The Ada language-sensitive editor supports navigation and browsing via menu entries in the contextual menu. Given an existing identifier, you may visit the corresponding declaration or body.

You may either left-click on the target and press F3, or right-click and select Open Declaration (or Open Body) from the editor’s contextual menu. If the cursor is not on an entity when visitation is requested, GNATbench will attempt to determine the enclosing program unit and visit the corresponding declaration or body.

contextual editor menu addition

The declarations and bodies of packages, protected types, tasks, procedures, and functions can be visited. In addition, you can navigate from an Ada declaration directly to its C or C++ implementation if the Ada declaration is completed by a pragma Import specifying convention C or CPP.

The declarations of types and objects may also be visited, in addition to the program units listed above. For example, given the use of a type in an object declaration, you may go to the declaration of that type using this interface.

Note that language-defined types declared in package Standard are not supported because there is no actual package Standard. However, language-defined types in other language-defined packages, such as System and Interfaces, are physically represented and are, therefore, supported.

Eclipse maintains a list of files visited in the editor and allows you revisit them using the yellow “Forward” and “Back” navigation arrows on the toolbar. (The left-arrow with an asterisk next to it, to the left of the Forward and Back buttons, visits the last location at which an actual editing change was made.) GNATbench is fully integrated with these navigation controls. Clicking one of these buttons visits the next or previous location visited, linearly. You may jump directly to any specific location in the list by clicking on the black down-arrow controls next to the buttons and selecting a file from the resulting list. The following figure shows a sample list:

forward and back buttons in toolbar