IDEA插件配置之Eclipse Code Formatter

Eclipse、Intellij idea格式化結果不同,致使長時間都是用兩個開發工具,idea開發eclipse進行格式化。可是如今這個問題能夠解決了。使用Eclipse Code Formatter。網絡


具體的插件地址:eclipse

http://plugins.jetbrains.com/plugin/6546?pr=idea&offset=15&max=15#comments_panide


Intellij idea:工具

1,安裝插件:開發工具

    硬盤安裝(推薦):Setting =>Plugins=>Install plugin from disk,選中下載好的安裝包【EclipseFormatter.zip】安裝,重啓後生效;idea

    網絡安裝:選擇Setting =>Plugins=>Browse repositories,搜索Eclipse便可出現,點擊左上角的Download and Install安裝。安裝以後重啓Intellij,插件

安裝完成便可在Setting =>Eclipse Code Formatter找到配置項。code


2,配置插件:orm

選擇Setting =>Other Settings =>Eclipse Code Formatter,勾選Use the Eclipse-code-formatter,並在Eclipse Java Formatter config file選擇Eclipse用的code-style.xml文件,這個選項會決定格式化代碼的方式。再選擇Java formatter profile 爲剛剛導入的文件。同時配置Import order的From File也爲Eclipse用的code-style.xml文件,這個選項會決定組織import區域的方式。xml


3,使用插件

使用Intellij的格式化快捷鍵」Ctrl+ALT+L」便可進行格式化。若是出錯會輸出提示到Event Log裏,若是看到’xxx formatted sucessfully by Eclipse code formatter’則表示格式化成功!

相關文章
相關標籤/搜索