5.7. Browsing via Reference Searching

In addition to browsing by navigating along the hyperlinks of individual Ada entities, you can also browse the code in a more “global” manner by searching for all references to a selected entity.

When the editor cursor (not the mouse cursor) is over a given entity in the Ada editor, or when the entity is selected, right-clicking with the mouse invokes a contextual menu that allows you to request a display of all references to that entity. (The menu entry is named “References”.)

references submenu

You control the scope of the search by selecting either “Project” or “Workspace” (or “Project Hierarchy”). Typically you will want to search within a single project but you can search all open projects by selecting “Workspace”.

The search results appear in the Search view. Clicking on one of these entries will traverse to the reference in the corresponding file, opening the file in the Ada editor if necessary. Within the editor, links to these references are added to the overview ruler and arrows are added to the annotation ruler.

The following figure illustrates the result of searching for the entity “Standard_Integer” in an Ada file. The Search view shows that the entity is declared in package “MS1553.Message_Element.Predefined” because of the icon appearing as a green circle with a ‘T’ in the middle. It further shows that “Standard_Integer” is referenced in a subprogram named “Pack” in that package. We have clicked on that Search entry so the editor has opened that file and highlighted the occurrences. Other references to “Standard_Integer” occur in three other packages and we could visit those occurrences in the same manner.

browsing references example

5.7.1. Advanced Options

You can refine the parameters of the references search in terms of Ada language features.

To do so, select “Advanced...” under the “References” submenu. Doing so will bring up the following dialog box, allowing you to select additional criteria for the search. You can also specify the same options as you would have without choosing the advanced options entry, namely the extent of the search itself (project, workspace, or project hierarchy).

advanced references options