Next: Navigating with hyperlinks, Previous: The Navigate Menu, Up: Source Navigation

### 6.3 Contextual Menus for Source Navigation

This contextual menu is available from any source editor. If you right click over an entity, or first select text, the contextual menu will apply to this selection or entity.

Goto declaration of entity
  Go to the declaration/spec of entity. The current entity is determined by the word located around the cursor or by the current selection if any. This capability requires support for cross-references.
Goto full declaration of entity
  This contextual menu appears for a private or limited private types. Go to the full declaration/spec of entity. The current entity is determined by the word located around the cursor or by the current selection if any. This capability requires support for cross-references.
Goto type declaration of entity
  Go to the type declaration of entity. The current entity is determined by the word located around the cursor or by the current selection if any. This capability requires support for cross-references.
Display type hierarchy for entity
  This contextual menu appears for derived or access types. Output the type hierarchy for entity into the location view. The current entity is determined by the word located around the cursor or by the current selection if any. This capability requires support for cross-references.
Goto body of entity
  Go to the body/implementation of entity. This capability requires support for cross-references.
Goto declarations of entity
  This contextual menu appears when you are clicking on a subprogram call that is a dispatching call. In such a case, there is no possibility for GPS to know what subprogram will actually be called at run time, since that depends on dynamic information. It therefore gives you a list of all entities in the tagged type hierarchy, and lets you choose which of the declarations you want to jump to. See also the `methods.py` plug-in (enabled by default) which, given an object, lists all its primitive operations in a contextual menu so that you can easily jump to them. See also the contextual menu `References/Find References To...` which allows you to find all calls to a subprogram or to one of its overriding subprograms.
Goto bodies of entity
  This is similar to Goto declarations of, but applies to the bodies of the entities.
Goto file spec/body
  Open the corresponding spec file if the current edited file is a body file, or body file otherwise. This option is only available for the Ada language.
Entity calls
  Display a list of all subprograms called by entity in a tree view. This is generally more convenient than using the corresponding Browsers/ submenu if you expect lots of references, See The Callgraph View.
Entity is called by
  Display a list of all subprograms calling entity in a tree view. This is generally more convenient than using the correponding Browsers/ submenu if you expect lots of references, See The Callgraph View.
References
  This item gives access to different capabilities related to listing or displaying references to the current entity or selection.
  `Find all references to entity`
    Find all references to entity in all the files in the project, See Find All References.
  `Find all references...`
    This menu is similar to the one above, except it is possible to select more precisely what kind of reference should be selected. It is also possible to indicate the scope of the search, and whether the context (or caller) at each reference should be displayed. Computing the caller information will take slightly longer though.

    This dialog has an option `Include overriding and overriden operations`, which, when activated, will include references to overriden or overriding entities of the one you selected.

    This is particularly useful when you are wondering whether you can easily modify the profile of a primitive operation, since you can then see what other entities will also be impacted. If you select only the `declaration` check box, you will see the list of all related primitive operations.

    This dialog also allows you to find out which entities are imported from a given file/unit. Click on any entity from that file (for instance on the `with` line for Ada code), then select the `All entities imported from same file` toggle button. This will display in the location window the list of all entities imported from the same file as the entity selected.

    In addition, if you have selected the `Show context` option, you will get a list of all the exact references to these entities within the file. Otherwise, you just get a pointer to the declaration of the imported entities.

  `Find all local references to entity`
    Find all references to entity in the current file (or in the current top level unit for Ada sources). See Find All References for more details.
  `Variables used in entity`
    Find all variables (local or global) used in entity and list each first reference in the locations window.
  `Non Local variables used in entity`
    Find all non-local variables used in the entity.
Methods of entity
  This submenu is only visible if you have activated the plug-in `methods.py` (which is the case by default), and when you click on a tagged type or an instance of a tagged type. This menu lists all the primitive operations of that type, and you can therefore easily jump to the declaration of any of these operations.
Browsers
  This item gives access to graph representations of callers and callees for subprograms.
  `Entity calls`
    Open or raise the call graph browser on the specified entity and display all the subprograms called by entity. See Call Graph.
  `Entity calls (recursively)`
    Open or raise the call graph browser on the specified entity and display all the subprograms called by entity, transitively for all subprograms. Since this can take a long time to compute and generate a very large graph, an intermediate dialog is displayed to limit the number of subprograms to display (1000 by default). See Call Graph.
  `Entity is called by`
    Open or raise the call graph browser on the specified entity and display all the subprograms calling entity. See Call Graph.

    Note that this capability requires a global look up in the project cross-references, which may take a significant amount of time the first time. After a global look up, information is cached in memory, so that further global queries will be faster.

Expanded code
  Present for Ada files only. This menu generates a .dg file using your gnat compiler (using the -gnatGL switch) and displays the expanded code. This can be useful when investigating low-level issues and tracing precisely how the source code is transformed by the GNAT front-end.
  `Show subprogram`
    Display expanded code for the current subprogram in the current editor.
  `Show file`
    Display expanded code for the current file in the current editor.
  `Show in separate editor`
    Display expanded code for the current file in a new editor.
  `Clear`
    Remove expanded code from the current editor.

  For Ada files only, this entry will generate, and will open this file at the location corresponding to the current source line.

Open <filename>
  When you click on a filename (for instance a C' `#include`, or an error message in a log file), this menu gives you a way to open the corresponding file. If the file name was followed by ":" and a line number, the corresponding line is activated.