1:設置注釋的模板:
下載此模板:codetemplates.xml
搜索Dangzhang,將其改為你自己的姓名,保存
打開eclipse/myeclipse
選擇 window-->Preferences-->java-->Code-->Code Templates 右邊點Import 選擇你寫好的模板.xml文件導入進去即可
2:設置格式化的模板:
格式化模板:eclipse-formatter.xml
格式化模版方法同上,只是不是選擇Code Templates ,而是選擇Formatter。
3:保存時自動格式化代碼:
打開eclipse/myeclipse
選擇 window-->Preferences-->JAVA-->Editor-->Save Actions
右邊選中:Perform the selected actions on save
Format source code
Format all lines
Organize imports
保存后重啟Myeclipse即可。
如下圖所示: