简体   繁体   English

Intellij IDEA:按实际顺序查看类方法

[英]Intellij IDEA: view class methods in their real order

I am switching to IntelliJ IDEA from Eclipse. 我正在从Eclipse切换到IntelliJ IDEA。 Currently I am using IDEA v 12.0.4. 目前,我正在使用IDEA v 12.0.4。

In Eclipse when you called Class Outline view ( Ctrl + O ) you saw methods in the order they are declared in the class. 在Eclipse中,当您调用类大纲视图( Ctrl + O )时,您会看到在类中声明方法的顺序。 While the similar File Structure view in IDEA ( Ctrl + F12 ) lists methods in the alphabetical order which I find less convenient for myself in some cases. 虽然IDEA中类似的“文件结构”视图( Ctrl + F12 )以字母顺序列出方法,但在某些情况下,我发现自己不太方便。

Is there a way in IDEA's File Structure popup to see class methods listed in the order they appear in the class? IDEA的“文件结构”弹出窗口中是否可以查看按类出现的顺序列出的类方法? Ideally I would like to have a possibility to switch from alphabetical to natural ordering. 理想情况下,我希望有可能从字母顺序切换为自然顺序。

使用“结构”工具窗口 (在Windows中为Alt + 7 ,在OS X中为 + 7 ),而不是“文件结构”弹出窗口。

There is actually a feature that allows both "by appearance" order and and omitting the grouping of members/fields and methods. 实际上,有一个功能既允许“按外观”顺序,又可以省略成员/字段和方法的分组。 I found the answer here , in a duplicate of this question: 我找到了答案在这里 ,在这个问题上的副本:

You can find the settings icon on right top of the project window, there you can find the option as below, to get the natural order. 您可以在项目窗口的右上方找到设置图标,在此处可以找到以下选项,以获取自然订单。

sort by type

According to the documentation though, this feature should do something else entirely: 但是根据文档 ,此功能应完全完成其他操作:

If the option is off, the items (files, classes, etc.) are sorted alphabetically. 如果关闭该选项,则项目(文件,类等)将按字母顺序排序。 If the option is on, the files are sorted by their extensions. 如果启用此选项,则文件将按其扩展名排序。 The .java files appear in the following order: interfaces, classes, enumerations, etc. .java文件按以下顺序出现:接口,类,枚举等。

You can use the Structure tool windows in the Floating mode. 您可以在Floating模式下使用结构工具窗口。
Then use Alt+7 instead of Ctrl+0 . 然后使用Alt+7代替Ctrl+0

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

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