Java代码模板的Eclipse自定义变量 [英] Eclipse Custom Variable for Java Code Templates
问题描述
如何添加要插入Java代码模板的新变量。如何在Window-> Preferences-> Java-> Code Style-> Code Templates-> Code-> New Java Files-> Edit-> Insert Variable ...?
How do you add a new variable to be inserted into a Java code template. How do I add a variable to the list in Window->Preferences->Java->Code Style->Code Templates->Code->New Java Files->Edit->Insert Variable... ?
目前我的新文件创建时间为:
Currently my new files get created with:
${filecomment}
${package_declaration}
${typecomment}
${type_declaration}
I' d喜欢用以下内容创建它们:
I'd like them to get created with something like:
${begin_filecomment}
${package_declaration}
${typecomment}
${type_declaration}
${end_filecomment}
其中begin_filecomment和end_filecomment出现在Insert Variable列表中。
where begin_filecomment and end_filecomment appear in the Insert Variable list.
推荐答案
我很确定变量列表是由Eclipse并没有办法添加新的模板变量。
I'm pretty sure that the list of "variables" is generated by Eclipse and there is no way to add a new template variable.
你想要什么 $ {begin_filecomment}
和 $ {end_filecomment}
是?只需在编辑框中键入内容 - 没有任何内容表明您不能在其中放置静态内容。
What do you want ${begin_filecomment}
and ${end_filecomment}
to be? Just type the content into the Edit box - there is nothing that says you cannot put static content in there.
这篇关于Java代码模板的Eclipse自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!