Find Usages for Apex code
You have an ability to find where else your Apex variable, class, method, etc. is being used, directly from the editor.
You can execute this search in 2 different ways:
- with a hotkey Shift+F12 — to find the usages of the “item” that is located in the position of your caret,
- using a context menu in the Apex Editor — just right-click on any “item” that you'd like to look for and select Find Usages.
The results of the Find Usages action pops up in a new panel.
Here you can see all the references to the item you've looked for, grouped by files.
In each results entry you will find:
- a type of construction where the search item was found: expression, method name, class name, etc (shown using an icon),
- a location within a file in the format
- a line of code where the item was found with the search item highlighted with a different background.
You can also double-click on any entry to be navigated to it directly in the editor.
Additionally, in the toolbar, you can find the following buttons that might help you navigating through the results faster.
- Expand all — expands all groups (files) in the results list,
- Collapse all — collapses all groups (files) in the results list,
- Go to definition — does the same as a simple double-click — navigates you directly to the selected entry in the Apex editor,
- Go to the previous location — navigates you to the previous result entry directly in the Apex editor,
- Go to the next location — navigates you to the next result entry directly in the Apex editor,
- Copy — copies the selected line of code to the clipboard,