zoukankan      html  css  js  c++  java
  • Eclipse设置模板codetemplates

    在Window->Preferences->Java->Code Style->Code Templates,
    点击"Import",导入模板codetemplates.xml文件
    具体内容如下:

     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 /**
     3  * ${bare_field_name}.
     4  *
     5  * @return  the ${bare_field_name}
     6  * @author ${user}
     7  * @Date ${date}${time} &lt;br/&gt;
     8  */</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">
     9 /**
    10  * ${param}.
    11  *
    12  * @param   ${param}    the ${bare_field_name} to set
    13  * @author ${user}
    14  * @Date ${date}${time} &lt;br/&gt;
    15  */</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">/**
    16  * Creates a new instance of ${enclosing_type}.
    17  * Description:
    18  * @author ${user}
    19  * @Date ${date}${time} &lt;br&gt;
    20  * ${tags}
    21  */
    22     </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">/**
    23  * Project Name:${project_name} &lt;br&gt;
    24  * File Name:${file_name} &lt;br&gt;
    25  * Package Name:${package_name} &lt;br&gt;
    26  * @author ${user}
    27  * Date:${date}${time} &lt;br&gt;
    28  * Copyright (c) ${year}, xxxx有限公司 All Rights Reserved.
    29  */</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">/**
    30  * ClassName: ${type_name} &lt;br&gt;
    31  * Description: ${todo} &lt;br&gt;
    32  * @author ${user}
    33  * @Date ${date}${time} &lt;br&gt;
    34  * @version
    35  */</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">/**
    36  * ${field}:${todo}(用一句话描述这个变量表示什么).
    37  */</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">
    38 /**
    39  * ${enclosing_method}:(这里用一句话描述这个方法的作用). &lt;br&gt;
    40  *
    41  * @author ${user}
    42  * @Date ${date}${time} &lt;br&gt;
    43  * ${tags}
    44  */</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">/**
    45  * ${todo} 简单描述该方法的实现功能(可选).
    46  * ${see_to_overridden}
    47  */</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">/**
    48  * ${tags}
    49  * ${see_to_target}
    50  */</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">/**
    51  * Project Name:${project_name} &lt;br&gt;
    52  * File Name:${file_name} &lt;br&gt;
    53  * Package Name:${package_name} &lt;br&gt;
    54  * @author ${user}
    55  * Date:${date}${time} &lt;br&gt;
    56  * Copyright (c) ${year}, xxxx有限公司 All Rights Reserved.
    57  */
    58 ${filecomment}
    59 
    60 ${package_declaration}
    61 /**
    62  * ClassName: ${type_name} &lt;br&gt;
    63  * Description: ${todo}
    64  * @author ${user}
    65  * @Date ${date}${time} &lt;br&gt;
    66  * @version
    67  */
    68 ${typecomment}
    69 ${type_declaration}
    70     </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">
    71     </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">
    72     </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">
    73     </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">
    74     </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">
    75     // ${todo} Auto-generated catch block
    76     ${exception_var}.printStackTrace();
    77     </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">
    78     // ${todo} Auto-generated method stub
    79     ${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">
    80     ${body_statement}
    81     // ${todo} Auto-generated constructor stub
    82     </template><template autoinsert="false" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">    return ${field};
    83     </template><template autoinsert="false" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">    ${field} = ${param};
    84     </template></templates>
    View Code
  • 相关阅读:
    shell
    Python全栈开发:django网络框架(二)
    Python全栈开发:django网络框架(一)
    动态规划问题以及诸多实例分析
    python实现并查集
    使用命令行编译和运行 c、Java和python程序
    整数除法操作的取整问题
    使用TensorFlow低级别的API进行编程
    使用TensorFlow高级别的API进行编程
    TensorFlow安装和HelloWorld
  • 原文地址:https://www.cnblogs.com/lookupthesky/p/9907356.html
Copyright © 2011-2022 走看看