Is there an Eclipse template variable for the short version of the nested type name

I would like to create a constructor template in the Eclipse classes for Java. I have a version that works for most classes. Although this does not work for classes nested in other classes. (see below the Inner class). How to get a short version of a class name?

The template does not work

 public ${newType:enclosing_type}() { ${cursor} } 

Failed class example

 public class Outer { public class Inner { // Current template expands to the following public Outer.Inner() { } } } 
+4
source share
1 answer

I checked Indigo. You can not. As far as I know, your only option is to enter a new variable in the list of templates to get the internal class name without the name (s) of the external class.

If you agree with the attempt to write some code (read the plugin) in order to get your goal, you can start with:

or if you are lazy like me, you can start downloading this project: https://github.com/aabeling/template-variables and configure it as your needs.

+1
source

Source: https://habr.com/ru/post/1389948/


All Articles