Difference Between Multiple Imported Eclipse Code Templates

In Eclipse 3.7, I saw java code templates with several variations of the ${import} command:

 ${:import} ${imp:import} ${x:import} 

What is the difference between the two?

+4
source share
1 answer

In the above example, you created 3 variables:

"" (i.e. empty)

"imp"

x

You can use these names to refer to variables later in the template. However, this is apparently largely useless in the case of import applications.

To get an idea of ​​how this can be used, it is useful to take a look at arraymerge, which is the template that comes with Eclipse, and you will see that the result variable is used in several places.

I suggest that you familiarize yourself with the templates that come with Eclipse and the excellent Useful Eclipse Java Code Templates to learn a little more.

Note. Inside the template, all variables must have unique names, so if you took your example above and added

  ${:importStatic} 

You will receive an error message since you have already used "" (empty) as the variable name.

+2
source

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


All Articles