myeclipse设置代码模板Code Templates

 

   

设置注释模板的入口: Window->Preference->Java->Code Style->Code Template

 

替换:codetemplates.xml即可

 

<?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">/**&#13;

* @Title: ${enclosing_method} &lt;BR&gt;&#13;

* @Description: ${todo} &lt;BR&gt;&#13;

* @return: ${field_type} &lt;BR&gt;&#13;

*/ </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">/**&#13;

* @Title: ${enclosing_method} &lt;BR&gt;&#13;

* @Description: ${todo} &lt;BR&gt;&#13;

* @return: ${field_type} &lt;BR&gt;&#13;

*/ </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">/**&#13;

* @Title: ${enclosing_type}&#13;

* @Description: ${todo}&#13;

* @param: ${tags}&#13;

* @throws&#13;

*/</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">/**&#13;

* FileName: ${file_name}&#13;

* @Description: ${todo}&#13;

* @author: gs-joe&#13;

* @version V1.0&#13;

* Createdate: ${date} ${time}&#13;

* Copyright: Copyright(C) 2016-2017&#13;

* Company xxxCompany.&#13;

* All rights Reserved, Designed By gs-joe&#13;

&#13;

* Modification History:&#13;

* Date Author Version Discription&#13;

* ---------------------------------------------------------------------------&#13;

* ${date} gs-joe 1.0 1.0&#13;

&#13;

* Why &amp; What is modified:&#13;

&#13;

*/</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">/**&#13;

* @ClassName: ${type_name}&#13;

* @Description: ${todo}&#13;

* @author: gs-joe&#13;

* @date: ${date} ${time}&#13;

*/</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">/** &#13;

* @Fields ${field} : ${todo}&#13;

*/ </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">/**&#13;

* @Title: ${enclosing_method}&#13;

* @Description: ${todo}&#13;

* @param: ${tags} &#13;

* @return: ${return_type} &#13;

* @throws&#13;

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

* &lt;p&gt;Title: ${enclosing_method}&lt;/p&gt;

* &lt;p&gt;Description: &lt;/p&gt;

* ${tags}

* ${see_to_overridden}

*/ </template><template autoinsert="false" 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="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}

${package_declaration}

 

${typecomment}

${type_declaration}</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">

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

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

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

</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">// ${todo} Auto-generated catch block

${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub

${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">${body_statement}

// ${todo} Auto-generated constructor stub</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>

posted on 2017-09-11 12:29  ${天涯过客}  阅读(562)  评论(0编辑  收藏  举报