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

时间:2013-03-12 09:50:38

标签: intellij-idea

我正在从Eclipse切换到IntelliJ IDEA。目前我正在使用IDEA v 12.0.4。

在Eclipse中,当您调用“类大纲”视图( Ctrl + O )时,您会看到方法在类中声明的顺序。虽然IDEA中的类似文件结构视图( Ctrl + F12 )按字母顺序列出了方法,但在某些情况下我觉得这种方法不太方便。

在IDEA的文件结构弹出窗口中是否有一种方法可以看到按照它们在类中出现的顺序列出的类方法?理想情况下,我希望有可能从字母顺序切换到自然顺序。

3 个答案:

答案 0 :(得分:45)

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

答案 1 :(得分:0)

实际上有一个功能允许"通过外观"订购和省略成员/字段和方法的分组。我找到了答案here,与此问题重复:

  

您可以在项目窗口的右上方找到设置图标,在那里您可以找到如下选项,以获得自然顺序。

     

.java

根据the documentation,此功能应该完全做其他事情:

  

如果该选项关闭,则项目(文件,类等)按字母顺序排序。如果启用该选项,则文件按其扩展名排序。 <?xml version="1.0" encoding="ISO-8859-1"?> <MainNode comment="foo"> <FirstMainBranch> <Struct> <String name="aStringValueUnderMainBranch" comment="Child node under first main branch"/> <String name="anotherStringValueUnderMainBranch" comment="Child node under first main branch"/> <Integer name="anIntegerValueUnderMainBranch" comment="Child node under first main branch"/> <List name="aList" comment="According to me this node should be an array, it could contain one or more child elements"> <Struct comment="The node name means that, the child nodes are grouped, I think that the most appropriate structure here is hash. The node itself doesn't have name attribute, which means that it only shows the type of the element"> <String name="first" comment=" Default Value: 0 "/> <Long name="second" comment=" Default Value: 0 "/> <Long name="third" comment=" Default Value: 0 "/> </Struct> </List> <List name="secondList" comment="According to me this node should be array, it could contain one or more child elements"> <Struct comment="The node name means that, the child nodes are grouped, I think that the most appropriate structure here is hash. The node itself doesn't have name attribute, which means that it only shows the type of the element "> <String name="first" comment=" Default Value: 0 "/> <Long name="second" comment=" Default Value: 0 "/> </Struct> </List> <Struct name="namedStruct" comment="Here the struct element has a name, which means that it should be decoded "> <List name="thirdList" comment="Again list, but now it is inside struct element, and it contains struct element "> <Struct comment="The node name means that, the child nodes are grouped, I think that the most appropriate structure here is hash."> <Integer name="first" comment="Child element of the struct"/> </Struct> </List> </Struct> </Struct> </FirstMainBranch> <SecondMainBranch> <Struct comment=""> <Struct name="namedStructAgain" comment=" "> <String name="First" comment=" "/> <String name="Second" comment=""/> </Struct> </Struct> </SecondMainBranch> </MainNode> 文件按以下顺序显示:接口,类,枚举等。

答案 2 :(得分:0)

您可以在Floating模式下使用“结构”工具窗口。
然后使用Alt+7代替Ctrl+0