Creating and editing code templates
Content Assist uses code templates to enable you to quickly make use of commonly used code segments.
To create a code template:
- Click Window > Preferences.
- Expand C/C++, expand Content Assist and select Templates.
- Click New.

Do the following: (if required)
- In the Name field, type a template name.
- In the Context drop down list, select the context type for the new template; either C/C++ or a Comment.
- In the Description field, type a description for the new code template.
- In the Pattern field, type the code for this template.
- Click Insert Variable to add a variable from the list to the code you have entered in the Pattern field.
- Click OK.
The new code template displays in the Templates list.
To edit a code template:
- Click Window > Preferences.
- Expand C/C++, expand Content Assist and select Templates.
- Click Edit. The Edit Template dialog opens.

Do the following:
- In the Name field, change the template name to create a new
template based on the current template.
- In the Context drop down list, select the context type for the new template; either C/C++ or a Comment.
- In the Description field, change the description of the code
template to reflect your changes.
- In the Pattern field, edit the code.
- Click Insert Variable to add a variable from the list to the
code you edited in the Pattern field.
- Click OK.
Content Assist
Using Content Assist
Importing and exporting code templates
Code Templates page, Preferences window
Code Templates page