Templates
-
When you get a list of templates in the content assist list (after
pressing Ctrl+Space), you can filter the list by typing additional
characters in the template's name.
-
You can define your own templates. Go to Window > Preferences > Java > Templates and press the New... button.
You can name your template and assign variables that will be filled in
by the editor when the template is inserted.
-
When a template is inserted in the editor, it tries to guess the
variable names. For example, if your template includes a reference
to an array, the template will try to resolve the array name when
inserted in code. If your code contains this statement:
void m(int[] foos){ for
and you use content assist to use te template "for -
iterate over array," the template will insert:
void m(int[] foos) { for (int i= 0; i < foos.length; i++) { } }
-
The dollar sign, $, is used to denote variables in a template. If
you need to include the dollar sign character itself in the template,
you must refer to it with $$.

Templates

Using templates
Writing your own templates

Template preference page