Eclipse代码注释模板-code template

参考帖子blog.csdn.net/security08/article/details/5588013

操作步骤:打开Window->Preferences->Java->Code Style->Code Templates

如图:

Eclipse代码注释模板-code template

 

 

点击“Import”,导入模板codetemplates.xml文件。

 

附:codetemplates.xml文件内容

<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**

 * <b>项目名:</b>系统项目名称<br/>

 * <b>包名:</b>${package_name}<br/>

 * <b>文件名:</b>${file_name}<br/>

 * <b>版本信息:</b><br/>

 * <b>日期:</b>${date}-${time}<br/>

 * <b>Copyright (c)</b> ${year}XX公司-版权所有<br/>

 * 

 */</template><template autoinsert="true" context="filecomment_context" deleted="false" description="Comment for created JavaScript files" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name="filecomment">/**

 * 

 */</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**

 * ${tags}

 * ${see_to_target}

 */</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name="typecomment">/**

 * @author kin

 *

 * ${tags}

 */</template><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">/**

 * 

 * <b>类名称:</b>${type_name}<br/>

 * <b>类描述:</b><br/>

 * <b>创建人:</b>kin<br/>

 * <b>修改人:</b>kin<br/>

 * <b>修改时间:</b>${date} ${time}<br/>

 * <b>修改备注:</b><br/>

 * @version 1.0.0<br/>

 * 

 */</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for vars" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**

 * 

 */</template><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">

/**

 * 创建一个新的实例 ${enclosing_type}.

 *

 * ${tags}

 */</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Jsdoc)

 * ${see_to_overridden}

 */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**

 * @param ${param} the ${bare_field_name} to set

 */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name="settercomment">/**

 * @param ${param} the ${bare_field_name} to set

 */</template><template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**

 * ${bare_field_name}

 *

 * @return  the ${bare_field_name}

 * @since   1.0.0

*/

</template><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">/**

 * ${enclosing_method}(这里用一句话描述这个方法的作用)<br/>

 * (这里描述这个方法适用条件 – 可选)<br/>

 * ${tags} 

 *${return_type}

 * @exception 

 * @since  1.0.0

*/</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**

 * ${tags}

 * ${see_to_target}

 */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**

 * ${tags}

 */</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)

 * ${see_to_overridden}

 */</template><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**

 * ${field}:${todo}(用一句话描述这个变量表示什么)

 *

 * @since 1.0.0

 */

</template><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**

 * @return the ${bare_field_name}

 */</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**

 * ${tags}

 */</template></templates>

 

你可能感兴趣的:(template)