STS 设置代码注释模板

打开Window->Preferences->Java->Code Style->Code Templates

 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><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">/**
 2  * ${bare_field_name}.
 3  *
 4  * @return  the ${bare_field_name}
 5  * @since   JDK 1.7.79
 6  */</template><template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
 7  * ${param}.
 8  *
 9  * @param   ${param}    the ${bare_field_name} to set
10  * @since   JDK 1.7.79
11  */</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">/**
12  * Creates a new instance of ${enclosing_type}.
13  *
14  * ${tags}
15  */
16 </template><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">/**
17  * Project Name: ${project_name}
18  * Author: ${user}
19  * File Name: ${file_name}
20  * Package Name: ${package_name}
21  * Date: ${date}${time}
22  * Copyright (c) ${year}, 315360007@qq.com All Rights Reserved.
23  *
24  */</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">/**
25  * ClassName:  ${type_name} &lt;br/&gt;
26  * Function:  ${todo} ADD FUNCTION. &lt;br/&gt;
27  * Reason:  ${todo} ADD REASON(可选). &lt;br/&gt;
28  * date:  ${date} ${time} &lt;br/&gt;
29  *
30  * @author ${user}
31  * @version ${enclosing_type}${tags}
32  * @since JDK 1.7.79
33  */</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">/**
34  * ${field}: ${todo}(用一句话描述这个变量表示什么).
35  * @since JDK 1.7.79
36  */</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">/**
37  * ${enclosing_method}: (这里用一句话描述这个方法的作用). &lt;br/&gt;
38  * ${todo}(这里描述这个方法适用条件 – 可选).&lt;br/&gt;
39  * ${todo}(这里描述这个方法的执行流程 – 可选).&lt;br/&gt;
40  * ${todo}(这里描述这个方法的使用方法 – 可选).&lt;br/&gt;
41  * ${todo}(这里描述这个方法的注意事项 – 可选).&lt;br/&gt;
42  *
43  * @author ${user}
44  * ${tags}
45  * @since JDK 1.7.79
46  */</template><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/**
47  * ${todo} 简单描述该方法的实现功能(可选).
48  * ${see_to_overridden}
49  */</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">/**
50  * ${tags}
51  * ${see_to_target}
52  */</template><template autoinsert="false" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">/**
53  * Project Name: ${project_name}
54  * File Name: ${file_name}
55  * Package Name: ${package_name}
56  * Date: ${date}${time}
57  * Copyright (c) ${year}, 315360007@qq.com All Rights Reserved.
58  *
59 */
60 ${filecomment}
61 
62 ${package_declaration}
63 /**
64  * ClassName: ${type_name} &lt;br/&gt;
65  * Function:  ${todo} ADD FUNCTION. &lt;br/&gt;
66  * Reason:      ${todo} ADD REASON. &lt;br/&gt;
67  * Date:      ${date} ${time} &lt;br/&gt;
68  * @author   ${user}
69  * @version  
70  * @since    JDK 1.7.79
71  * @see      
72  */
73 ${typecomment}
74 ${type_declaration}
75 </template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
76 </template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
77 </template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
78 </template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
79 </template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">
80 // ${todo} Auto-generated catch block
81 ${exception_var}.printStackTrace();
82 </template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">
83 // ${todo} Auto-generated method stub
84 ${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">
85 ${body_statement}
86 // ${todo} Auto-generated constructor stub
87 </template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
codetemplates.xml

 

转:http://chenzhou123520.iteye.com/blog/1625629

posted @ 2016-04-18 16:32  —八戒—  阅读(1862)  评论(0编辑  收藏  举报