5

In Eclipse 3.7 I've seen java code templates with several variations of the ${import} command:

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

What's the difference between them?

Gabriel Belingueres
  • 2,945
  • 1
  • 24
  • 32

1 Answers1

3

In the above example you have created 3 variables:

"" (ie blank)

"imp"

"x"

You can use these names to refer to the variables later on within the template. However this seems to be largely useless in the case of import statements.

To get an idea of how this might be used usefully take a look at arraymerge, which is a template shipped with Eclipse, and you will see the result variabe being used in a few places.

I suggest taking a look at the templates that ship with Eclipse and the excellent Useful Eclipse Java Code Templates question to learn a bit more.

Note: Within a template all variables must have unique names, so if you took your example above and added

  ${:importStatic}

You will get an error, as you have already used "" (blank) as a variable name.

Community
  • 1
  • 1
katsharp
  • 2,551
  • 24
  • 27