设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元素。

文件注释codetemplates.xml:

   
   
   
   
  1. xml version="1.0" encoding="UTF-8" standalone="no"?> 
  2. <templates> 
  3.     <template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/** 
  4.  * Description: 
  5.  * ${file_name} Create on ${date} ${time}  
  6.  * @author Kristain 
  7.  * @version 1.0 
  8.  * Copyright (c) ${year} Company,Inc. All Rights Reserved. 
  9.  */template> 
  10. templates> 

方法注释method.xml:

   
   
   
   
  1. xml version="1.0" encoding="UTF-8" standalone="no"?> 
  2. <templates> 
  3.     <template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/** 
  4.  * Description: 
  5.  * Date:${date} 
  6.  * @author kristain 
  7.  * ${tags}  
  8.  * @return ${return_type} 
  9.  */template> 
  10. templates>