跳转到 Eclipse IDE 中的接口实现 [英] Jump into interface implementation in Eclipse IDE

查看:15
本文介绍了跳转到 Eclipse IDE 中的接口实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道在 Eclipse 中,在方法上按 F3 会带您到它的声明吗?好吧,我有一个作为接口一部分的方法;点击 F3 自然而然地将我带到声明界面.

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 over this naturally takes me to the declaring interface.

显然有一个对象实现了这个接口,这就是方法实际实现的地方.我想,当我按下 F3 时,跳转到实现,而不是接口声明.我知道在编译时可能不知道实现,那么 Eclipse 有没有办法向我显示实现接口的所有类,以便我可以选择要查看的实现方法?现在发生这种情况时,我只是手动搜索以找到实现的方法.

Obviously there is an object implementing this interface and this is where the method is actually implemented. I want, when I press F3, to jump to the implementation, not the interface declaration. I know that the implementation may not be known at compile-time, so is there a way for Eclipse to show me all the classes implementing the interface so that I can select which implemented method to view? Right now when this happens I am just manually searching for this to find the implemented method.

推荐答案

这是我的工作:

  • 在界面中,将光标移动到方法名称.按 F4.=> 出现类型层次结构视图
  • 在视图的下部,应该已经选择了方法.在其工具栏中,单击锁定视图并在层次结构中显示成员"(应该是最左侧的工具栏图标).
  • 在视图的上部,您可以浏览该方法的所有实现.
  • 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.

这篇关于跳转到 Eclipse IDE 中的接口实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆