Intellij插入文件模板头 [英] Intellij Insert File Template Header

查看:54
本文介绍了Intellij插入文件模板头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Intellij中创建新的Java类时,将自动插入文件头(基于文件模板"选项).有没有办法将相同的模板插入到现有的Java源文件中?我希望有一种方法可以在现有代码上使用模板定义,而无需在所有位置进行剪切/粘贴.该模板利用了宏扩展,我希望能够保留该宏.eclipse中有一个类似的函数称为生成元素注释",可以处理这种情况.这在Intellij IDEA中存在吗?

When you create a new java class in Intellij a file header is automatically inserted (based on "File Templates" options). Is there a way to insert that same template into an existing java source file? I was hoping there was a way to use my template definition on existing code without doing a cut/paste all over the place. The template makes use of macro expansion and I hope to be able to keep that. There is a similar function in eclipse called "Generate Element Comment" that would handle this case. Does this exist within Intellij IDEA?

任何帮助将不胜感激.

推荐答案

也许最好的解决方案是使用实时模板",但是您无法重用文件模板,因此,您最终将需要一个副本/粘贴.操作

Maybe the best solution is to use a "Live Template" but you can´t reuse the File Template, so, you will need at last one copy/paste operation

这篇关于Intellij插入文件模板头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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