Show code references in Eclipse IDE editor

Ever wish you could quickly see where your code has been used, without having to perform a search or user shortcut key combination? Now you can with Code Mining!

Before, finding out where your code was used was a little tedious and required a couple of steps; either a key combination Ctlr+Shift+G, or bring up the context-menu.

But now with Eclipse IDE 4.10 you can enable “Code Mining” to display code references inline, for Methods, Fields, Types and Implementations.

Enable Code Mining

From the Eclipse IDE, navigate to Window -> Preferences -> Java ->Editor -> Code Mining

Code Mining Preferences

Click the checkbox to Enable Code Mining, then Apply and Close

Enabled Code Mining

Next, close all opened files in your editor and then open a file do display the new Code Mining Reference hints.

The Reference Hints will show you the amount of references for that type as well as a way to quickly see them. Click on one reference hint.and it will automatically run a search for that type and display results in the Search tab.

Code Mining Reference – Search Results