如何在 Eclipse 中找到类的引用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3839156/
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 can I find references of a class in Eclipse?
提问by BalusC
I have a java class in my project, how can I find all of the places it's being used? Similar to Visual Studios find references.
我的项目中有一个 java 类,如何找到它正在使用的所有地方?类似于 Visual Studios 查找引用。
Thanks.
谢谢。
回答by BalusC
Put the mouse cursor/caret on the class or method name in source code and hit Ctrl+Shift+G.
将鼠标光标/插入符号放在源代码中的类或方法名称上,然后点击Ctrl+ Shift+ G。
回答by Bozho
- Right-click the class in project explorer, or in the editor
- Select
References -> Project
(or the other options, if they fit your case better)
- 在项目资源管理器或编辑器中右键单击该类
- 选择
References -> Project
(或其他选项,如果它们更适合您的情况)
回答by user3165731
Just a follow up since I was looking for all references for ALL public methods of a class in Eclipse:
只是跟进,因为我正在寻找 Eclipse 中类的所有公共方法的所有引用:
- Open the class in the editor
- Open the Outline view
- select all the methods you want to analyze
- Hit Ctrl+Alt+H
- 在编辑器中打开类
- 打开大纲视图
- 选择您要分析的所有方法
- 命中Ctrl+ Alt+H
This gives call hierarchy results for each method you selected. Hope this helps!
这将为您选择的每个方法提供调用层次结构结果。希望这可以帮助!
Edit: used the actual LIST item formatter
编辑:使用实际的 LIST 项目格式化程序