views:

374

answers:

4

When I have Java code like this:

someInterface.someMethod();

how do I get Netbeans to show me which classes have implementations of someMethod() (not the interface).

In Eclipse this is done with Ctrl+T, but pressing Ctrl+T on the method did nothing in Netbeans 6.5 and I can't where the type hierarchy functionality is in Netbeans 6.5.

Thanks.

A: 

To get a hierarchy similar to the type hierarchy in Eclipse, right click on the class name, select Navigate, and then Inspect Hierarchy. The keyboard shortcut for this is ALT+SHIFT+F12. By default, it shows you parents of the selected class or interface. However, you can view descendants by using the Filters at the bottom left side. I believe the Show Subtype Hierarchy filter (also toggled by using CTRL+B) is what you want.

This is accurate in NetBeans 6.7.1. I'm going to assume it is similar in 6.5.

Thomas Owens
You've misunderstood my question. I have an interface and want to see which implementations are available for a method of the interface. Eclipse shows me the various implementations, ALT+SHIFT+F12 doesn't do anything for an interface in Netbeasn 6.5.1.
Dean Schulze
A: 

It turns out that there is no comparable functionality in Netbeans. You can read about it here:

http://forums.netbeans.org/viewtopic.php?p=49355#49355

I've also filed an enhancement request here, which you can vote for:

http://www.netbeans.org/issues/show_bug.cgi?id=172830

If you want to see this added to Netbeans please vote for it.

Dean Schulze
+1  A: 

This functionality already exists in Netbeans: Alt+F7, check 'Find All Subtypes', and click OK. Thanks to tkellerer for pointing this out on the Netbeans forums

http://forums.netbeans.org/viewtopic.php?p=49638#49638

This is widely overlooked functionality in Netbeans, perhaps because there is no key binding for it, so I've changed my enhancement request to add a key binding for the sequence "Alt+F7, check 'Find All Subtypes', and click OK"?

Dean Schulze
A: 

Hey, someone has implemented a module to do this, and it works in Netbeans 6.5.1 - perfect for you. I'm hanging out to see an equivalent for 6.7.1. Maybe they should add it to 6.8!

http://wiki.netbeans.org/JavaGoToImplementation

Go To Implementation is built in for recent versions of NetBeans. Look in the Navigate context menu.

trafalmadorian