`
yujianlong1988
  • 浏览: 7055 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

总结一下别人说的东西。eclipse自动格式化代码

 
阅读更多

win32下的redis
https://github.com/downloads/dmajkic/redis/redis-2.1.5-win32.zip

 

eclipse自动化代码格式,统一规范

1.修改Java->Code Style->Organize Import, 设置Number of static imports needed of * to 1
这样设置的话,import static org.junit.Assert.* 不会被解开成import static org.junit.Assert.Equal
2.设置使用JDK 而不是 JRE, Java->Install JREs,否则看不到JDK自己的源码,而且Jetty编译JSP失败.
3.在 Windows->Preferences->Java->Code Style的Cleanup 和 Formatter 中分别导入cleanup-profile.xml 和formatter.xml
文件1:formatter-profile.xml, 分享地址: http://vdisk.home.news.cn/vdisk/download/0008b3a21b5aab9a
文件2:cleanup-profile.xml, 分享地址: http://vdisk.home.news.cn/vdisk/download/0008b3b65a480579
4.修改Windows->Preference->Java->Editor->SaveAction,勾选Perform the select actions on save,Formate All Codes,与Organize Imports
5.修改Windows->Preferences->XML->XML Files->Editor  ,Line width增加到120字符

 

这样设置后,每次保存,都会自动格式化代码
文件1:formatter-profile.xml, 分享地址: http://vdisk.home.news.cn/vdisk/download/0008b3a21b5aab9a
文件2:cleanup-profile.xml, 分享地址: http://vdisk.home.news.cn/vdisk/download/0008b3b65a480579

 

4.修改Windows->Preference->Java->Editor->SaveAction,勾选Perform the select actions on save,Formate All Codes,与Organize Imports

这个设置就是,一保存文件就格式化,哈哈,想不格式化都不行

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics