myeclipse 添加注释的 模板

来源:互联网 发布:iphone7plus发说说软件 编辑:程序博客网 时间:2024/06/03 09:44

http://blog.csdn.net/arui_email/article/details/9494641


[html] view plain copy
 print?
  1. 1、打开myeclipse工具。  
[html] view plain copy
 print?
  1. 2、window-Preferences-java-Code Style-Code Templates-import。  
[html] view plain copy
 print?
  1. 3、下面就是xml的文件内容信息。  
[html] view plain copy
 print?
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.   
  3. <templates>  
  4.   
  5.         
  6.   
  7.     <template     
  8.   
  9.                 autoinsert="false"     
  10.   
  11.                 context="constructorcomment_context"     
  12.   
  13.                 deleted="false"     
  14.   
  15.                 description="Comment for created constructors"     
  16.   
  17.                 enabled="true"     
  18.   
  19.                 id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"  
  20.   
  21.                 name="constructorcomment">  
  22.   
  23.     /**    
  24.   
  25.      * 创建一个新的实例 ${enclosing_type}.    
  26.   
  27.      *    
  28.   
  29.      * ${tags}    
  30.   
  31.      */    
  32.   
  33.     </template>  
  34.   
  35.         
  36.   
  37.     <template     
  38.   
  39.                 autoinsert="true"     
  40.   
  41.                 context="settercomment_context"  
  42.   
  43.                 deleted="false"     
  44.   
  45.                 description="Comment for setter method"     
  46.   
  47.                 enabled="true"     
  48.   
  49.                 id="org.eclipse.jdt.ui.text.codetemplates.settercomment"     
  50.   
  51.                 name="settercomment">  
  52.   
  53.     /**    
  54.   
  55.      * @param ${param} the ${bare_field_name} to set    
  56.   
  57.      */    
  58.   
  59.     </template>  
  60.   
  61.         
  62.   
  63.         
  64.   
  65.     <template  
  66.   
  67.                 autoinsert="false"     
  68.   
  69.                 context="methodcomment_context"     
  70.   
  71.                 deleted="false"     
  72.   
  73.                 description="Comment for non-overriding methods"     
  74.   
  75.                 enabled="true"     
  76.   
  77.                 id="org.eclipse.jdt.ui.text.codetemplates.methodcomment"     
  78.   
  79.                 name="methodcomment">  
  80.   
  81.     /**    
  82.   
  83.      * 此方法描述的是:    
  84.   
  85.      * @author: <a href="mailto:XXX@qq.com">XXX@qq.com</a>    
  86.   
  87.      * @version: ${date} ${time}    
  88.   
  89.      */    
  90.   
  91.     </template>  
  92.   
  93.         
  94.   
  95.         
  96.   
  97.     <template     
  98.   
  99.                 autoinsert="true"     
  100.   
  101.                 context="delegatecomment_context"     
  102.   
  103.                 deleted="false"     
  104.   
  105.                 description="Comment for delegate methods"     
  106.   
  107.                 enabled="true"     
  108.   
  109.                 id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"     
  110.   
  111.                 name="delegatecomment">  
  112.   
  113.     /**    
  114.   
  115.      * ${tags}    
  116.   
  117.      * ${see_to_target}    
  118.   
  119.      */    
  120.   
  121.     </template>  
  122.   
  123.          
  124.   
  125.         
  126.   
  127.     <template  
  128.   
  129.                 autoinsert="false"     
  130.   
  131.                 context="filecomment_context"     
  132.   
  133.                 deleted="false"     
  134.   
  135.                 description="Comment for created Java files"     
  136.   
  137.                 enabled="true"     
  138.   
  139.                 id="org.eclipse.jdt.ui.text.codetemplates.filecomment"     
  140.   
  141.                 name="filecomment">  
  142.   
  143.     /**    
  144.   
  145.      * 文件名:${file_name}    
  146.   
  147.      *    
  148.   
  149.      * 版本信息:    
  150.   
  151.      * 日期:${date}    
  152.   
  153.      * Copyright 公司 Corporation ${year}     
  154.   
  155.      * 版权所有    
  156.   
  157.      *    
  158.   
  159.      */    
  160.   
  161.     </template>  
  162.   
  163.         
  164.   
  165.         
  166.   
  167.     <template     
  168.   
  169.                 autoinsert="false"     
  170.   
  171.                 context="gettercomment_context"     
  172.   
  173.                 deleted="false"     
  174.   
  175.                 description="Comment for getter method"     
  176.   
  177.                 enabled="true"     
  178.   
  179.                 id="org.eclipse.jdt.ui.text.codetemplates.gettercomment"     
  180.   
  181.                 name="gettercomment">  
  182.   
  183.     /**    
  184.   
  185.      * ${bare_field_name}    
  186.   
  187.      *    
  188.   
  189.      * @return the ${bare_field_name}    
  190.   
  191.      * @since   CodingExample Ver(编码范例查看) 1.0    
  192.   
  193.     */    
  194.   
  195.     </template>  
  196.   
  197.    
  198.   
  199.     <template     
  200.   
  201.                 autoinsert="true"     
  202.   
  203.                 context="overridecomment_context"     
  204.   
  205.                 deleted="false"     
  206.   
  207.                 description="Comment for overriding methods"     
  208.   
  209.                 enabled="true"     
  210.   
  211.                 id="org.eclipse.jdt.ui.text.codetemplates.overridecomment"     
  212.   
  213.                 name="overridecomment">  
  214.   
  215.     /* (non-Javadoc)    
  216.   
  217.      * ${see_to_overridden}    
  218.   
  219.      */    
  220.   
  221.     </template>  
  222.   
  223.         
  224.   
  225.         
  226.   
  227.     <template     
  228.   
  229.                 autoinsert="false"     
  230.   
  231.                 context="fieldcomment_context"     
  232.   
  233.                 deleted="false"     
  234.   
  235.                 description="Comment for fields"     
  236.   
  237.                 enabled="true"     
  238.   
  239.                 id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"     
  240.   
  241.                 name="fieldcomment">  
  242.   
  243.     /**    
  244.   
  245.      * ${field}:${todo}(用一句话描述这个变量表示什么)    
  246.   
  247.      *    
  248.   
  249.      * @since Ver 1.1    
  250.   
  251.      */    
  252.   
  253.     </template>  
  254.   
  255.         
  256.   
  257.         
  258.   
  259.     <template     
  260.   
  261.                 autoinsert="false"     
  262.   
  263.                 context="typecomment_context"     
  264.   
  265.                 deleted="false"     
  266.   
  267.                 description="Comment for created types"     
  268.   
  269.                 enabled="true"     
  270.   
  271.                 id="org.eclipse.jdt.ui.text.codetemplates.typecomment"     
  272.   
  273.                 name="typecomment">  
  274.   
  275.     /**    
  276.   
  277.      * 此类描述的是:    
  278.   
  279.      * @author: <a href="mailto:XXX@126.com">XXX@126.com</a>    
  280.   
  281.      * @version: ${date} ${time}     
  282.   
  283.      */    
  284.   
  285.     </template>  
  286.   
  287.      
  288.   
  289. </templates>  
  290.    
[html] view plain copy
 print?
  1. 下面是注释规范大家可以根据自己公司的规范写,举例如下:  
[html] view plain copy
 print?
  1. <p>文件(Files)注释标签:</p><p>/**  
  2. *  
  3. @Title: ${file_name}   
  4. *   
  5. @Package ${package_name}   
  6. *   
  7. @Description: ${todo}   
  8. *   
  9. @author  
  10. *   
  11. @date ${date} ${time}   
  12. *   
  13. @version V1.0  
  14. */ </p><p>类型(Types)注释标签(类的注释):</p><p>/**   
  15. *  
  16. 类功能说明:  
  17. *  
  18. 类修改者:  
  19. 修改日期:  
  20. *   
  21. 修改说明:  
  22. <p>Title: ${file_name}</p>   
  23. <p>Description:XXX科技开发平台</p>   
  24. <p>Copyright: Copyright (c) 2006</p>   
  25. <p>Company:XXX公司</p>   
  26. * @author ${user}   
  27. * @date ${date} ${time}   
  28. * @version V1.0   
  29. */  
  30.  </p><p>字段(Fields)</p><p>注释标签:  
  31.    
  32. /**   
  33. @Fields   
  34. ${field} : ${todo}   
  35. */ </p><p>构造函数标签:</p><p>/**   
  36. <p>Title: </p>   
  37. *   
  38. <p>Description: </p>   
  39. *   
  40. ${tags}   
  41. */ </p><p>方法(Constructor & Methods)</p><p>标签:  
  42. /**   
  43. *函数功能说明:  
  44. *${user}   
  45. *${date}    
  46. *修改者名字:  
  47. *修改日期:  
  48. *修改内容  
  49. *${tags}  
  50. <a href="mailto:*@return">*@return</a> ${return_type}      
  51. <a href="mailto:*@throws">*@throws</a>   
  52. */  </p><p>getter  
  53. 方法标签:</p><p>/**   
  54. <a href="mailto:*@return">*@return</a> ${bare_field_name}   
  55. */ </p><p>setter</p><p>方法标签:</p><p>/**   
  56. <a href="mailto:*@param">*@param</a> ${param}   
  57. *  
  58. *${bare_field_name}   
  59. */ </p>  


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 芡粉里面有虫了怎么办 勾芡淀粉放多了怎么办 剁排骨没有好刀怎么办 硬币掉进档位里怎么办 魅族mx5手机太卡怎么办 华为m9手机声音小怎么办 放卡的地方堵住怎么办 美图m8蓝屏了怎么办 美图m8手机蓝屏怎么办 美图m6s手机白屏怎么办 魅蓝2开不开机怎么办 魅族手机主键没反应怎么办 魅族手机主键失灵怎么办 手机4g网络不稳定怎么办 华为m9收不到手机信息怎么办 华为手机wifi信号弱怎么办 手机连接wifi信号差怎么办 华华为p10信号不好怎么办 烟没拆封受潮了怎么办 和亲儿子发生了性关系怎么办 无心磨磨出来圆度不好怎么办 中国人在越南办结婚证怎么办? 无线网被限速了怎么办 联通大王卡上传速度慢怎么办 小米手机下载视频速度慢怎么办 大疆御air脚架断了怎么办 大疆飞行器线断了怎么办 移动校园卡套餐到期后怎么办 流量年包到期了怎么办 家里无线网信号不好怎么办 无线网光信号红灯了怎么办 机顶盒获取不了lp地址怎么办 32内存卡丢了怎么办 手机上的相机找不到了怎么办 有刘鑫这样的闺蜜该怎么办 电脑开机网络初始化失败怎么办 电脑放音乐没有声音怎么办 苹果手机gprs信号弱怎么办 苹果导航gprs信号弱怎么办 au没有波形 没有声音怎么办 屏幕驱动板坏了怎么办