If I'm in an interface and pointing to a method name, what can I do to quickly go to the ONLY implementation of that method ?
如果我在一个接口中,指向一个方法名,我要怎么做才能快速访问该方法的唯一实现呢?
using eclipse 3.6.x
使用eclipse 3.6.x
3 个解决方案
#1
69
I just checked this on my Eclipse 3.6 install: Hold control (command on Mac), hover over the method name and select "Open Implementation".
我刚刚在我的Eclipse 3.6 install中检查了这一点:按住control (Mac上的命令),将鼠标移到方法名上并选择“Open Implementation”。
You may assign a keyboard shortcut to this action by using Window > Preferences > General > Keys and searching for "Open Implementation".
您可以通过使用窗口>首选项>常规>键并搜索“Open Implementation”为该操作指定一个键盘快捷方式。
#2
92
F3 is the typical "go to implementation". For interfaces that go to the interface definition.
F3是典型的“go to implementation”。对于到接口定义的接口。
Instead use Ctrl + T to see all implementations of the interface definition. You can then easily go to the one you want with the arrow keys and Enter. I believe that the first one is automatically selected so that Ctrl-T + Enter will do what you need.
使用Ctrl + T查看接口定义的所有实现。你可以很容易地找到你想要的箭头键并进入。我相信第一个是自动选择的,因此Ctrl-T + Enter将完成您所需要的操作。
#3
20
In the keymap (General > Keys) search for "open implementation" and map it to whatever you want. I chose Ctrl + Shift + I. Make sure you select "Editing Java Source" in the When box. I tested it, and having the cursor over the method name and pressing Ctrl + Shift + I took me directly to the implementation instead of showing the hierarchy that you get with Ctrl + T.
在keymap(一般>键)中搜索“open implementation”并将其映射到您想要的任何地方。我选择了Ctrl + Shift + I,确保在框中选择“编辑Java源”。我对它进行了测试,并将光标放在方法名上并按下Ctrl + Shift +,我直接将鼠标移到实现中,而不是显示使用Ctrl + T获得的层次结构。
Also you can see an answer to a nearly identical question for other options:
你也可以看到一个几乎相同的问题的答案:
- In eclipse, ctrl-click goes to the declaration of the method I clicked. For interfaces with one implementation, how can I just directly to that implementation?
- 在eclipse中,ctrl-click指向我单击的方法的声明。对于具有一个实现的接口,我如何直接到那个实现呢?
#1
69
I just checked this on my Eclipse 3.6 install: Hold control (command on Mac), hover over the method name and select "Open Implementation".
我刚刚在我的Eclipse 3.6 install中检查了这一点:按住control (Mac上的命令),将鼠标移到方法名上并选择“Open Implementation”。
You may assign a keyboard shortcut to this action by using Window > Preferences > General > Keys and searching for "Open Implementation".
您可以通过使用窗口>首选项>常规>键并搜索“Open Implementation”为该操作指定一个键盘快捷方式。
#2
92
F3 is the typical "go to implementation". For interfaces that go to the interface definition.
F3是典型的“go to implementation”。对于到接口定义的接口。
Instead use Ctrl + T to see all implementations of the interface definition. You can then easily go to the one you want with the arrow keys and Enter. I believe that the first one is automatically selected so that Ctrl-T + Enter will do what you need.
使用Ctrl + T查看接口定义的所有实现。你可以很容易地找到你想要的箭头键并进入。我相信第一个是自动选择的,因此Ctrl-T + Enter将完成您所需要的操作。
#3
20
In the keymap (General > Keys) search for "open implementation" and map it to whatever you want. I chose Ctrl + Shift + I. Make sure you select "Editing Java Source" in the When box. I tested it, and having the cursor over the method name and pressing Ctrl + Shift + I took me directly to the implementation instead of showing the hierarchy that you get with Ctrl + T.
在keymap(一般>键)中搜索“open implementation”并将其映射到您想要的任何地方。我选择了Ctrl + Shift + I,确保在框中选择“编辑Java源”。我对它进行了测试,并将光标放在方法名上并按下Ctrl + Shift +,我直接将鼠标移到实现中,而不是显示使用Ctrl + T获得的层次结构。
Also you can see an answer to a nearly identical question for other options:
你也可以看到一个几乎相同的问题的答案:
- In eclipse, ctrl-click goes to the declaration of the method I clicked. For interfaces with one implementation, how can I just directly to that implementation?
- 在eclipse中,ctrl-click指向我单击的方法的声明。对于具有一个实现的接口,我如何直接到那个实现呢?