7

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.

Dean Schulze
  • 9,633
  • 24
  • 100
  • 165

5 Answers5

10

I find that Ctrl+Alt+B works perfectly. :)

Sam R.
  • 16,027
  • 12
  • 69
  • 122
jonasespelita
  • 1,660
  • 5
  • 25
  • 31
5

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
  • 9,633
  • 24
  • 100
  • 165
  • I know this is an old post but I have never found that Netbeans 'find implementations' works reliably and I wonder whether it has to do with the context the function is used in. For example do projects in which implement the interface need to be open? I work with a lot of OSGi bundles and very rarely does this function work in Netbeans and it's something that would be extremely useful in that context. – D-Dᴙum Dec 11 '15 at 09:40
1

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
  • 114,398
  • 98
  • 311
  • 431
  • 2
    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 Sep 01 '09 at 18:52
0

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
  • 9,633
  • 24
  • 100
  • 165
0

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
  • 1,660
  • 1
  • 15
  • 21