是否有简短版本的封闭类型名称的Eclipse模板变量 [英] Is there a Eclipse template variable for short version of enclosing type name
问题描述
Inner
以下)如何获取类名的简短版本? 不工作的模板
public $ {newType:surrounding_type}(){
$ {cursor}
}
示例失败类
public class Outer {
public class Inner {
//当前模板扩展到以下
public Outer.Inner(){
}
}
}
我检查了靛蓝。你不行据我所知,你唯一的选择是在模板列表中引入一个新的变量,以获得没有外部类名的内部类名。
如果您接受编写一些代码(阅读插件)以达到目标的努力,您可以从以下开始:
或者如果你像我一样懒惰,你可以开始下载这个项目: https://github.com/aabeling/template-variables ,并根据您的需要进行自定义。
I would like to create a constructor template in Eclipse for Java classes. I've got a version that works for most classes. Although it doesn't work for classes nested in other classes. (see class Inner
below) How do I get the short version of the class name?
Not working template
public ${newType:enclosing_type}() {
${cursor}
}
Example failing class
public class Outer {
public class Inner {
// Current template expands to the following
public Outer.Inner() {
}
}
}
I checked on Indigo. You can't. Your only option, as far as i know, is to introduce a new variable in template list in order to get inner class name without the outer class(es) name(s).
If you accept the effort of writing a bit of code (read plugin) to get your goal, you can start from:
- http://thomaswabner.wordpress.com/2009/08/21/use-your-own-variable-in-eclipse-code-templates/
- How to pass parameter into code-template in eclipse-plugin
- Eclipse Custom Variable for Java Code Templates
or if you are lazy like me, you can start downloading this project: https://github.com/aabeling/template-variables and customizing it as your needs.
这篇关于是否有简短版本的封闭类型名称的Eclipse模板变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!