为MyEclipse添加自定义注释

来源:互联网 发布:python 移动文件 编辑:程序博客网 时间:2024/06/07 03:18
最近开发的项目使用的注释比较多,所以网上查了一下资料,把eclipse这个工具添加注释的方法给分享了吧!

1、针对方法的注释:
Window > Preferences > Java > Code Style > Code Templates 选中右侧的 Methods 点击 Edit 将下面的添加即可
/** 
 *${tags} 
 *@author xxxx 
 *@date ${date} ${time} 
 *@comment  
 */ 
@author 作者 @date系统时间 去系统当前时间 @comment代码说明

在方法上面敲入/**按回车会自动将上面的填写到注释中。


还有一种方法就是导入 点击 import 将下面的代码写入一个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">/** 

 *${tags} 
 *@author ${user} 
 *@date ${date} ${time} 
 *@comment  

 */</template>

</templates> 


1 0
原创粉丝点击