fastcodejava
fastcodejava

Reputation: 41117

Search by Implementation class in eclipse

Can one search by the implementation or its methods in eclipse? It would be really useful. An example is given below.

public interface Foo {
    public void method();
}

public class FooImpl implements Foo {
    // I should be able to select this and search and it should 
    // show the whoever called Foo.method
    public void method() {

    }
}

Upvotes: 1

Views: 5871

Answers (4)

Scott
Scott

Reputation: 17057

Another method is mentioned in this post. Instead of using CTRL+H or CTRL+SHIFT+G you can use CTRL+T to open a pop-up in place instead of a new Eclipse tab as the other methods do.

Upvotes: 2

卢声远 Shengyuan Lu
卢声远 Shengyuan Lu

Reputation: 32014

Select "Foo" in the editor -> right-click -> Open Type Hierarchy (or F4). The "Type Hierarchy" View will open -> On this View, click the icon for the function "Show the Sub-Type Hierarchy" (or "Show All Inherited Members").

Eclipse will show all the Child classes.

Upvotes: 6

Maxym
Maxym

Reputation: 11906

If you see a method, called from interface, then just position mouse cursor over it, press ctrl and you see menu with options "Open Declaration | Open Implementation". In your case press "Open Implementation". In case this method is implemented by many classes you will get a popup with "Types implementing or defining...". Quite nice feature :)

UPDATE: according to your example... If I understood it right, then when you select method, press ctrl+shift+G and you see all places where this method is called.

Upvotes: 10

Harry Joy
Harry Joy

Reputation: 59694

You can use default search option. Access it by pressing CTRL+H. Go to Java search tab. Here you can write method name and search for it.

Upvotes: 1

Related Questions