tags:

views:

66

answers:

2

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); 
+6  A: 

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.

froadie
+1  A: 

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.

Progman