Jump into interface implementation in Eclipse IDE

后端 未结 11 1100
陌清茗
陌清茗 2020-12-12 09:37

You know how in Eclipse, pressing F3 over a method will take you to its declaration? Well I have a method that is part of an interface; clicking F3 ove

相关标签:
11条回答
  • 2020-12-12 10:11

    If you are really looking to speed your code navigation, you might want to take a look at nWire for Java. It is a code exploration plugin for Eclipse. You can instantly see all the related artifacts. So, in that case, you will focus on the method call and instantly see all possible implementations, declarations, invocations, etc.

    0 讨论(0)
  • 2020-12-12 10:12

    I always use this implementors plugin to find all the implementation of an Interface

    http://eclipse-tools.sourceforge.net/updates/

    it's my favorite and the best

    0 讨论(0)
  • 2020-12-12 10:16

    Here's what I do:

    • In the interface, move the cursor to the method name. Press F4. => Type Hierarchy view appears
    • In the lower part of the view, the method should already be selected. In its toolbar, click "Lock view and show members in hierarchy" (should be the leftmost toolbar icon).
    • In the upper part of the view, you can browse through all implementations of the method.

    The procedure isn't very quick, but it gives you a good overview.

    0 讨论(0)
  • 2020-12-12 10:18

    Well... well... I hope you use Eclipse Helios, because what you asked is available on Helios.

    Put your text cursor again on the method and click menu Navigate → Open Implementation. Now if you have more than one implementation of the method, you will get choice to pick which implementation to open.

    alt text

    By defining a keybinding on Preferences → General → Keys you can even use the feature easier, but before you do that, see if this shortcut is fast enough for you.

    Press Ctrl + click and hold. Now move your mouse over the same method. Tadam… you will get choice.

    alt text

    If you pick Open Implementation you’ll get the same choice as before.

    0 讨论(0)
  • 2020-12-12 10:19

    There's a big productivity boost if you add an Alt + F3 key binding to the Open Implementation feature, and just use F3 to go to interfaces, and Alt + F3 to go to implementations.

    Open implementation keybinding

    0 讨论(0)
  • 2020-12-12 10:22

    Highlight an interface and use Ctrl+T to open "Quick Type Hierarchy".

    0 讨论(0)
提交回复
热议问题