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:
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.