Search code examples
javaeclipseimportjava-package

Seeing where the import got called


For example, if I perform some shortcut on import java.util.HashMap; in a class, I want Eclipse to show the lines where I instantiate HashMaps and call HashMap methods in that class.


Solution

  • You can try the shortcut Ctrl + Shift + G for references of the class or Ctrl + G for declarations.

    or

    Right click your class (in your Java editor) and go to either References or Declarations.

    enter image description here

    I only use Ctrl + Shift + G for searching for references.

    Inside the Class, you can find references to the class turning on the option in the menu bar as marked. Clicking on a class or variable, it will highlight the references/occurrences in your class.

    enter image description here