Many times the type of code written is repetitive. (If you don’t agree, you have not yet heard about design patterns.) Eclipse support many kinds of templates. Higher level templates for files/function. Lower level templates for loops and similar constructs. You can even have your own custom templates.
What makes these templates special, their own inherent intelligence.
e.g. The for loop template:
for (${var} = 0; ${var} < ${max}; ++${var}) {
${line_selection}${cursor}
}
When a for template is created, you need to enter the var only once. The other two entries (comparison and increment) are filled automatically.
Here is an example to introduce for loop
over a selection of code.
Select the code block
Press Ctrl + Space
. Eclipse would also show a preview of the changes
Eclipse has now put in the template. Note that colored blocks and the cursor mark (Circled for reference)
Type the value for the iterator. (In this case iTest
and press TAB
Now you can update value of the MAX limit.