eclipse Code Style设置

来源:互联网 发布:javascript 刷新 编辑:程序博客网 时间:2024/05/21 00:16

Code Style主要包括下面几个方面。

代码清理过程:

进入eclipse菜单: Window > Preferences > Java > Code Style > Clean Up,点击界面上方的Import,在弹出框中选择位于eclipse安装路径下的eclipse/cleanup-profile.xml,点击打开,点击右下角的 Apply 使其生效。

代码格式化过程:

进入eclipse菜单: Window > Preferences > Java > Code Style > Formatter,使用类似上述的方法导入eclipse/formatter-profile.xml,并使其生效。

设置代码格式化的实现时间(一般为当保存的时候自动格式化):

进入eclipse菜单: Window > Preferences > Java > Editor > Save Actions,勾选上Perform the selected actions on save 下的Format source code,并选择 Format all lines,勾选上Organize imports,点击右下角的Apply 使其生效。

转载自:Code Style设置

0 0
原创粉丝点击