fastcodejava
fastcodejava

Reputation: 41117

Automatically go to a Class in eclipse from Instance

Is there a way to automatically go to a Class in eclipse from an instance of it.

Foo foo = new Foo();
// lots of lines of code
foo.some();   // from foo I want to go to the Class Foo direcly with a key press.

I received some answers but that is not what I was looking for. Sometime I don't call a method, I just have reference foo only, e.g when calling other method :

method(foo, bar); 

Upvotes: 0

Views: 10100

Answers (2)

Progman
Progman

Reputation: 19555

You can ctrl-click on the variable name and you get to the variable declaration. And then you can ctrl-click on the type to get to the class definition.

Upvotes: 1

froadie
froadie

Reputation: 83133

Hold down control and click on the class name.

You can also go to specific methods from method calls by using the "Open Declaration" functionality. So hold down control and click on some() and it will take you to that method's declaration in the Foo class. (Or hit F3, or right-click and choose "Open Declaration.")

Or you can use the constructor in the line: Foo foo = new Foo(); to jump to the class' constructor, which will also take you to the class.

Upvotes: 9

Related Questions