设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元素。
文件注释codetemplates.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <templates> <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">/** * Description: * ${file_name} Create on ${date} ${time} * @author Kristain * @version 1.0 * Copyright (c) ${year} Company,Inc. All Rights Reserved. */</template> </templates>
方法注释method.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <templates> <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">/** * Description: * Date:${date} * @author kristain * ${tags} * @return ${return_type} */</template> </templates>
当一个人找不到出路的时候,最好的办法就是将当前能做好的事情做到极致,做到无人能及。