Eclipse 代碼風格設定

來源:互聯網
上載者:User

 

http://phl.iteye.com/blog/1028218

 

由於eclipse的預設代碼風格很不實用,本文針對性的給出一些個人化。
統一代碼風格,是方便專案管理,為整個團隊建立良好的環境,減少閱讀成本;所有的強大的團隊協作,都是點滴積累的。
本文以eclipse3.6.2_javaee為例,其他版本是否相容,暫不清楚.
1.【window】/【preferences】/【Java】/【code style】/【formatter】/【edit】

2.面板【indentation】
tab policy = spaces only
indentation size = 4
tab size = 4
他的作用是只適用空格縮排,不使用table,這樣可以去除不同平台下的txt識別問題

選中align fields in columns
他的作用是對其類中定義的屬性

3 面板【line wrapping】
maximum line width = 400
他的作用是不讓代碼自動換行

【method declarations】/【Parameters】
line wrapping policy = wrap all elements, exception first element if not necessary
選中 force split, even if line shorter than maxmum width
indentation policy = indent on column
這的作用是在方法聲明的時候,一個參數一行,尤其是spring mvc裡一個方法十幾個參數的時候,看著非常爽

4 面板【comments】
去掉 Enable line comment formatting
他的含義是去掉單行注釋的格式化

5 若想直接匯入模板,請見附件最新版本。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.