Eclipse保存源碼添加自動動作選項

灬猜想灬 12年前發布 | 2K 次閱讀 開源機器人 框架 Google Earth

Eclipse提供自動源碼格式選項,并且組織輸入(刪除未使用的代碼)。你可以使用下面的這些快捷鍵進行操作。

Ctrl + Shift + F——源代碼格式

Ctrl + Shift + O——組織輸入并刪除未使用的代碼

代替手動調用這兩個函數,只需根據Eclipse自動格式和自動組織選項,可以隨時保存文件。

操作步驟,在Eclipse中進入Window -> Preferences -> Java -> Editor -> Save Actions,然后以選定的方式保存,最后檢查Format source code + Organize imports。

Additional actions:
Remove 'this' qualifier for non static field accesses
Remove 'this' qualifier for non static method accesses
Convert control statement bodies to block
Add final modifier to private fields
Add final modifier to method parameters
Add final modifier to local variables
Remove unused imports
Remove unused private methods
Remove unused private constructors
Remove unused private types
Remove unused private fields
Add missing '@Override' annotations
Add missing '@Override' annotations to implementations of interface methods
Add missing '@Deprecated' annotations
Remove unnecessary casts
Remove trailing white spaces on all lines

 本文由用戶 灬猜想灬 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!