Java 如何使用 Eclipse IDE 查找用法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25618181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find usages using Eclipse IDE?
提问by gstackoverflow
I have following code:
我有以下代码:
public class MyClass{
...
}
At same workspace I have following class
在同一个工作区,我有以下课程
public class AnotherClass{
@Autowired
MyClass myClass;
...
}
If I click right mouse button on MyClass
(first mentioned) and select "open call hierarchy" I don't see anything.
如果我在MyClass
(首先提到的)上单击鼠标右键并选择“打开调用层次结构”,我什么也看不到。
How to find this usage in Eclipse?
如何在 Eclipse 中找到这种用法?
采纳答案by Vinit Prajapati
Right click on Myclass, find references in project|workspace.
右键单击 Myclass,在 project|workspace 中找到引用。
Open call hierarchy, open inheritance hierarchy.
开放调用层次,开放继承层次。
回答by paul
Try right-click on MyClass
and then References->Workspace
. I think this might be what you're looking for.
尝试右键单击MyClass
,然后单击References->Workspace
。我想这可能就是你要找的。
Also works on methods, variables etc.
也适用于方法、变量等。
回答by Pranalee
PC:
个人电脑:
- Select a word (class name, method name, variable name, etc.)
- Press Ctrl+Shift+G
- 选择一个词(类名、方法名、变量名等)
- 按 Ctrl+Shift+G
Mac:
苹果电脑:
- Select a word (class name, method name, variable name, etc.)
- Press Alt+Cmd+G(?+?+G)
- 选择一个词(类名、方法名、变量名等)
- 按Alt+Cmd+G( ?+?+G)
回答by Nilesh
Select the resource (method name, class name ) & right click . You will find a menu with title 'Open Call Hierarchy' (shortcut key : alt + Ctrl + H ). This will enlist all the usage in project.
选择资源(方法名称、类名称)并右键单击 。您会找到一个标题为“打开呼叫层次结构”的菜单(快捷键:alt + Ctrl + H)。这将列出项目中的所有用法。
回答by maoyang
For your case, I think both of (Ctrl+Shift+G) and (Ctrl+Alt+H) work.
对于您的情况,我认为 ( Ctrl+ Shift+ G) 和 ( Ctrl+ Alt+ H) 都有效。
To make it more clear:
为了更清楚地说明:
(Ctrl+Shift+G) is shortkey for Search->References->workspace
Ctrl+Alt+His short key for Call hierarchy.
( Ctrl+ Shift+ G) 是 Search->References->workspace 的快捷键
Ctrl+ Alt+H是调用层次快捷键。
Some other useful short keys like:
其他一些有用的快捷键,例如:
- (Ctrl+G) : Search->Declaration->worksapce
- (Alt+Left) : Back position
- (Alt+Right) : Forward position
- ( Ctrl+ G) : 搜索->声明->工作空间
- ( Alt+ Left) : 背部位置
- ( Alt+ Right) : 前锋位置
回答by Danilo Raspa
For Mac, press cmd+ Shift+ G
对于 Mac,按cmd+ Shift+G
回答by Karthik
To my knowledge, both of Ctrl+Shift+Gand Ctrl+Alt+Hshould work.
据我所知,这两个Ctrl+ Shift+G和Ctrl+ Alt+H应该工作。
For Your Information:
供您参考:
Ctrl+Shift+G--> is the short key for Search --> References --> workspace
Ctrl+ Shift+ G--> 是 Search --> References --> workspace 的快捷键
Ctrl+Alt+H--> is the short key for Call hierarchy.
Ctrl+ Alt+ H--> 是调用层次结构的快捷键。