简体   繁体   English

如何在Eclipse中找到重写的方法?

[英]How to find the overridden method in Eclipse?

当我在eclipse中查看一个方法时,如何跳转到覆盖/扩展的方法?

Three ways to go about it. 有三种方法可以解决这个问题。

Hyperlink Method (Mouse + Keyboard) 超链接方法(鼠标+键盘)

Press CTRL while hovering over the overriden method. 将鼠标悬停在覆盖方法上时按CTRL键。

You should see an option called 'Open Super Implementation. 您应该会看到一个名为“Open Super Implementation”的选项。 Click it ! 点击它 !

From here : 这里

在此输入图像描述

Keyboard shortcut 键盘快捷键

And for bonus points, you can setup a Keyboard shortcut to do this like so : 对于奖励积分,您可以设置键盘快捷键,如下所示:

在此输入图像描述

When you try to setup a keyboard shortcut, you may filter by typing Open Super Im . 当您尝试设置键盘快捷键时,可以通过键入Open Super Im过滤。 On my Eclipse Indigo three matches were found. 在我的Eclipse Indigo上找到了三场比赛。 I tried setting them one by one until the shortcut appeared in Navigate -> Open Super Implementation like so : 我尝试逐个设置它们,直到快捷方式出现在Navigate -> Open Super Implementation如下所示:

在此输入图像描述

Mouse only - Using the vertical Ruler 仅限鼠标 - 使用垂直标尺

在此输入图像描述

Click the ovverride marker that appears in the Vertical Ruler as in the above snapshot. 单击垂直标尺中显示的ovverride标记,如上面的快照中所示。

On the left edge of the editor there is a small triangle symbol next to the overwritten method. 在编辑器的左边缘,覆盖方法旁边有一个小三角形符号。 The tooltip tells you which superclass you are overwriting, clicking it leads you to the corresponding method. 工具提示会告诉您要覆盖的超类,单击它会引导您进入相应的方法。

Screenshot: 截图:

截图

(Indigo Release) Put cursor on the method name and press CTRL+T to jump to the types list, from there you can jump to the super method. (Indigo Release)将光标放在方法名称上并按CTRL + T跳转到类型列表,从那里你可以跳转到super方法。 If you then click CTRL+T again it expands the supertype hierarchy. 如果再次单击CTRL + T,则会展开超类型层次结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM