问题描述
我有一个包含大约 30 个方法的大类.是否可以在 eclipse 中按字母顺序自动对它们进行排序?我希望这样做,以便在浏览 Java 或查看课程大纲窗口时更容易找到它们.
I have a large class that contains about 30 methods. Is it possible to automatically sort them in alphabetical order in eclipse? I was hoping to do this so they would be easier to find when java browsing or looking at the class outline window.
推荐答案
如果您只想按排序顺序查看您的班级成员而不修改代码,那么您可以像其他人一样单击大纲视图上的 A/Z 图标已经指出.或者,您可能希望在代码本身中对类成员进行排序,在这种情况下,您应该右键单击源或源文件名以获取上下文相关菜单,然后选择源(Alt-Shift-S),对成员进行排序.
If you just want to view your class members in sorted order without modifying the code then you can click on the A/Z icon on the outline view, as others have pointed out. Alternatively, you may wish to sort the class members in the code itself, in which case you should right click your source or source file name to get the context sensitive menu, then select Source(Alt-Shift-S), Sort Members.
它会弹出一个对话框让你自定义排序,选择你想要的选项,然后点击确定.
It will pop up a dialog box allowing you to customize the sort, choose your desired options and click ok.
这篇关于Eclipse 按字母顺序组织方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!