简体   繁体   English

Eclipse键盘快捷键列出项目中的所有类

[英]Eclipse Keyboard Shortcut To List All Classes in Project

Eclipse has this awesome thing called a Quick Outline CTRL + O . Eclipse有一个很棒的东西叫做Quick Outline CTRL + O. I want something similar but with classes, as I am entering a new project with tons of classes and no clue which source file they come from. 我想要类似但有类的东西,因为我正在进入一个包含大量类的新项目,并且不知道它们来自哪个源文件。

Example: Press CTRL + Shift + O and all classes are listed, you start typing it modifies the list, you press enter, it opens that source file. 示例:按CTRL + Shift + O并列出所有类,您开始键入它修改列表,按Enter键,它将打开该源文件。

Does this functionality exist in Eclipse? Eclipse中是否存在此功能? I looked through the Keys menu, couldn't find anything, probably not using the right name for it. 我查看了Keys菜单,找不到任何东西,可能没有使用正确的名称。

Ctrl + Shift + T : All Types ( Classes ) in open projects in workspace Ctrl + Shift + T工作区打开项目中的所有类型( Classes

Ctrl + Shift + R : All Files (java, xml, properties) in open projects in workspace Ctrl + Shift + R工作区打开项目中的所有文件(java,xml,属性)

First one in useful in finding classes ABC , XYZ , SABC : 第一个在查找ABCXYZSABC类时非常有用:

public class ABC {

class XYZ { }

static class SABC { }

}

Ctrl + Shift + R to search for class names using wildcards. Ctrl + Shift + R使用通配符搜索类名。

This can be used not just for class files but any type of file. 这不仅可用于类文件,还可用于任何类型的文件。

Try using CTRL + SHIFT + R which displays a list of all classes/files which can be filtered. 尝试使用CTRL + SHIFT + R ,它显示可以过滤的所有类/文件的列表。 It saves tons of time. 它节省了大量时间。

This shortcut is known as open resource . 此快捷方式称为开放资源

If you need to search for a class whose name may not match the filename, such as an inner class you can use file search in combination with class [classname] . 如果需要搜索名称可能与文件名不匹配的类,例如内部类,则可以将文件搜索与class [classname]结合使用。

File Search 文件搜索

CTRL + H , then click file search and enter class [yourclasnamehere] . 按CTRL + H ,然后单击文件搜索并输入class [yourclasnamehere]

File search is very useful, it will search the contents of every file for a supplied token. 文件搜索非常有用,它将搜索每个文件的内容以获取提供的令牌。 I found it so useful I gave the shortcut its own mapping. 我发现它非常有用,我给了它自己的映射快捷方式。

I know its a little late to answer it but would like to add my two cents. 我知道回答它有点晚了,但我想补充两分钱。 apart from all the answers above one can also use 'Type Hierarchy' in eclipse to list down all the classes alphabetically in a specific project of workspace. 除了上面的所有答案之外,还可以使用eclipse中的“类型层次结构”在特定的工作空间项目中按字母顺序列出所有类。

In left pane select project whose classes you wish to see and press F4 在左窗格中,选择要查看其类的项目,然后按F4

Alternatively, In left pane select project whose classes you wish to see, right click and click on "Open Type Hierarchy" 或者,在左窗格中选择要查看其类的项目,右键单击并单击“打开类型层次结构”

select project and open Type Hierarchy or Simply press Shortcut F4 选择项目并打开“ 类型层次结构”或只需按快捷键F4

]

It will look like below 它将如下所示

在此输入图像描述

使用Ctrl + Shift + H键搜索类。

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

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