Eclipse新建类的时候如何自动添加注释(做者,时间的信息)

方法一:Eclipse中设置在建立新类时自动生成注释 windows

windows–>preference
Java–>Code Style–>Code Templates
code–>new Java files
编辑它spa

${filecomment}
${package_declaration}
/**
* @author 做者 E-mail:
* @version 建立时间:${date} ${time}
* 类说明
*/
${typecomment}
${type_declaration}.net

 

 

方法二:code

经过菜单 Window->Preference 打开参数设置面板,而后选择:
Java -> Code Style -> Code     Templatesorm

在右侧选择Comments,将其中的Files项,而后选右边的”Edit”,进入编辑模式:blog

进入编辑模式后就能够自定义注释了。另外能够插入一些变量,如年、日期等等。ip

最后,确保 Code -> New Java files 中有:”${filecomment}”rem

固然,经过“导出”和“导入”功能,你能够把本身的模板导出来在其余机器上使用。get

以上是文件注释,类中的方法自动添加注释相似,对应于Files下面的Types。it

Eclipse快捷键:选中你的方法后alt+shift+J

http://blog.csdn.net/dadoneo/article/details/6285594

相关文章
相关标签/搜索