Eclipse feature to arrange a class file?

て烟熏妆下的殇ゞ 提交于 2019-12-24 02:38:40

问题


Eclipse has tons of features, i'm wondering if this one exsists? Or if any shortcut ways of doing it exist?

I want to arrange my class data into Variables, Constructors, Methods in that flow(Top to Bottom)

Further refined I would like to arrange by access level(pub, private, protected) and type - void or methods that return. The same for Vars - access level and type.

Any ideas. I mean I try to keep my code as tidy as possible. But would be nice to kind of format a class that perhaps I havent written that is messy.


回答1:


If you go the preferences screen and then go to Java -> Appearance -> Members Sort Order you can configure the sort order for members.

Next just right click when you have a file open and go to Source -> Sort members




回答2:


Under Preferences choose Java -> Appearance -> Members Sort Order. This allows you to set the order of members within a class when you use the Sort Members action.



来源:https://stackoverflow.com/questions/4107944/eclipse-feature-to-arrange-a-class-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!