Issue
I often have to debug Java code which was written so that there is an interface and exactly one implementation of that interface.
For instance there would be an interface Foo with exactly one implementation called FooImpl
. In the following code if I Ctrl-click on doThings
it'll jump to Foo.java
when I actually want to go to FooImpl.java
to see the implementation.
public void doStuff(Foo foo) {
foo.doThings();
}
When I end up at the interface I have to use Ctrl-Shift-R to open up FooImpl
. It'd be really nice if I could do something lick Ctrl-Alt-click on doThings
and end up inside FooImpl.java
. If there are multiple implementations in the workspace then perhaps it would just pop up a box telling me what they are.
Is there a plugin or existing function in eclipse that does this? I know that I could go to Foo.java
and then get the hierarchy and go to the implementation, but that's more clicks than are necessary when there is exactly one implementation of an interface.
Solution
The Implementors plugin does pretty much exactly what you ask for. If there is only one implementation it will open it directly, otherwise it will let you choose.
Answered By - Micke
Answer Checked By - Mildred Charles (JavaFixing Admin)