Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Java Development User Guide
Previous Page Home Next Page

Editor Templates

Templates are a structured description of coding patterns that reoccur in source code. The Java editor supports the use of templates to fill in commonly used source patterns. Templates are inserted using content assist (Ctrl+Space).

For example, a common coding pattern is to iterate over the elements of an array using a for loop that indexes into the array. By using a template for this pattern, you can avoid typing in the complete code for the loop. Invoking content assist after typing the word for will present you with a list of possible templates for a for loop. You can choose the appropriate template by name (iterate over array). Selecting this template will insert the code into the editor and position your cursor so that you can edit the details.

Templates can contain template variables. Variables mark the editable locations. They can be resolves to a concrete value when the template is evaluated in its context. They can also provide a list of alternative proposals valid at the given location.

Many common templates are already defined. These can be viewed with the Goto the Java editor preferences page Java > Editor > Templates preference page. You can also create your own templates or edit the existing ones.

Related reference

Templates preferences
Template variables
Template editing
Edit menu
Java content assist



 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire