Java 你如何在 Eclipse 中获得完全限定的类名?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25597424/
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 do you get the fully qualified class name in Eclipse?
提问by CodyBugstein
Is there a fast way to click on a Java class in Eclipse and obtain its fully qualified name, or copy it to the clipboard?
是否有一种快速的方法可以在 Eclipse 中单击 Java 类并获取其完全限定名称,或者将其复制到剪贴板?
采纳答案by óscar López
Try this:
尝试这个:
- Hover the mouse pointer over the name of a class in the editor window, it can be anywhere in the code where a class name appears
- In the pop-up window that appears, double-click the fully-qualified name
- Press Ctrl+ cto copy
- 将鼠标指针悬停在编辑器窗口中的类名上,它可以位于代码中出现类名的任何位置
- 在出现的弹出窗口中,双击完全限定名称
- 按Ctrl+c复制
Alternatively:
或者:
- In the project explorer (generally the left window), click on a class name
- Press Alt+ ENTERto display the properties window
- Select and copy the class' path. But you'll need to manually replace the
/
characters with.
- 在项目资源管理器(通常是左侧窗口)中,单击一个类名
- 按Alt+ENTER显示属性窗口
- 选择并复制类的路径。但是您需要手动将
/
字符替换为.
回答by Eran
When you hover over it, you see the full name.
当您将鼠标悬停在它上面时,您会看到全名。
And if you click on the window that opens, you can mark the full name and copy it to the clipboard :
如果您单击打开的窗口,您可以标记全名并将其复制到剪贴板:
回答by Xiao
Instead of clicking the "Fully Qualified Name" item in the popup, you can simply use its shortcut, Y
, when menu is shown. See letter Y underlined on screenshot in Dollyn's answer.
Y
显示菜单时,您可以简单地使用其快捷方式,而不是单击弹出窗口中的“完全限定名称”项。请参阅 Dollyn 回答中屏幕截图上带下划线的字母 Y。
回答by Dollyn
Edit on 2016-06-29:
2016-06-29 编辑:
As pointed by Jeff, you only need the 2nd step in the following:
正如 Jeff 所指出的,您只需要下面的第 2 步:
1. Double-click on the class name in the source code.
2. Right-click and select "Copy Qualified Name"
1. 双击源代码中的类名。
2. 右键单击并选择“复制限定名称”
回答by JonyD
I have a simpler solution: just create a key shortcut
我有一个更简单的解决方案:只需创建一个快捷键
Menu Window > Preferences > (write "keys") > search for "Copy Qualified Name" > add any not-yet-assigned key shortcut. Apply > OK.
菜单窗口>首选项>(写“键”)>搜索“复制限定名称”>添加任何尚未分配的快捷键。应用 > 确定。
There. Ready to use. Easy.
那里。可以用了。简单。