设置注释模板的入口: 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>
本文转自sucre03 51CTO博客,原文链接:http://blog.51cto.com/sucre/1093107,如需转载请自行联系原作者