設置注釋模板的入口:
Window-<Preference-<Java-<CodeStyle-<Code Template 然後展開Comments節點就是所有需設置注釋的元素。現就每一個元素逐一介紹:
/**
* Copyright © ${year}公司名字. All rights reserved.
*
* @Title: ${file_name}
* @Prject: ${project_name}
* @Package: ${package_name}
* @Description: ${todo}
* @author: ${user}
* @date: date {time}
* @version: V1.0
*/
/**
* @ClassName: ${type_name}
* @Description: ${todo}
* @author: ${user}
* @date: date {time}
* ${tags}
*/
/**
* @fieldName: ${field}
* @fieldType: ${field_type}
* @Description: ${todo}
*/
/**
* @Title:${enclosing_type}
* @Description:${todo}
* ${tags}
*/
/**
* @Title: ${enclosing_method}
* @Description: ${todo}
* ${tags}
* @return: ${return_type}
*/
/* (non Javadoc)
* @Title: ${enclosing_method}
* @Description: ${todo}
* ${tags}
* ${see_to_overridden}
*/
/**
* ${tags}
* ${see_to_target}
*/
/**
* @return the ${bare_field_name}
*/
/**
* @param paramthe {bare_field_name} to set
*/
或者可以從網上下載配置好的.xml文件導入也可以。
PS:在按照上面的方法設置後,一定要到windows->Preferences->general->Content Types,右側Context Types樹,點開Text,選擇Java Source File,在下面的Default encoding輸入框中輸入UTF-8,點Update,則設置Java文件編碼為UTF-8,否則會出現字符編碼的問題。
經過如上的設置後,就可以使用快捷鍵Alt+Shift+J來快速生成文檔的注釋了。使用方法如下:
--------------------------------------分割線 --------------------------------------
Ubuntu 14.04 LTS安裝Java 8和Eclipse 4.4 http://www.linuxidc.com/Linux/2014-11/109217.htm
Hadoop Eclipse 插件編譯安裝1.2.0 http://www.linuxidc.com/Linux/2013-07/87428.htm
Hadoop在Eclipse中的插件編譯 http://www.linuxidc.com/Linux/2013-04/83295.htm
Hadoop 1.2.1編譯Eclipse插件 http://www.linuxidc.com/Linux/2013-10/91666.htm
Ubuntu 13.10安裝JDK、Eclipse for C/C++(解決全局菜單問題) http://www.linuxidc.com/Linux/2013-11/92305.htm
如何在Ubuntu 14.04中安裝最新版Eclipse http://www.linuxidc.com/Linux/2014-08/105090.htm
--------------------------------------分割線 --------------------------------------
Eclipse 的詳細介紹:請點這裡
Eclipse 的下載地址:請點這裡