在Eclipse中将作者名称自动添加到现有文件中 [英] Adding author name in Eclipse automatically to existing files

查看:183
本文介绍了在Eclipse中将作者名称自动添加到现有文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一个真正易于使用的工具(没有怪物工具),我可以插入Eclipse,然后按生成标题按钮,然后作者名称出现在该项目的每个文件中?

Is there a real easy to use tool (no monster tool) that I can plug into Eclipse, and press a "generate header" button and then the authors name appears in every file in that project?

推荐答案

实际上在Eclipse Indigo thro Mars中,你必须去类型模板 Window - >偏好 - > Java - >代码样式 - >代码模板 - > (在右侧窗格中)注释 - >双击类型,并确保它具有以下默认值:

Actually in Eclipse Indigo thro Mars, you have to go to the Types template Window -> Preferences -> Java -> Code Style -> Code templates -> (in right-hand pane) Comments -> double-click Types and make sure it has the following, which it should have by default:

/**
 * @author ${user}
 *
 * ${tags}
 */

据我所知,Eclipse中没有任何将javadoc自动添加到一个批次中的现有文件。您可以从命令行轻松地执行 sed & awk 但这是另一个问题。

and as far as I can tell, there is nothing in Eclipse to add the javadoc automatically to existing files in one batch. You could easily do it from the command line with sed & awk but that's another question.

如果您准备单独打开每个文件,然后选择类/界面申报行,例如公共类AdamsClass {然后按键组合 Shift + Alt + J ,这将在上面插入一个新的javadoc注释,以及作者标签为您的用户。要尝试其他设置,请转到 Windows->首选项 - > Java-> Editor->模板

If you are prepared to open each file individually, then selected the class / interface declaration line, e.g. public class AdamsClass { and then hit the key combo Shift + Alt + J and that will insert a new javadoc comment above, along with the author tag for your user. To experiment with other settings, go to Windows->Preferences->Java->Editor->Templates.

这篇关于在Eclipse中将作者名称自动添加到现有文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆