Creating and editing templates
Content Assist uses templates to enable you to quickly make use of commonly used code segments.
To create a template:
- Click Window > Preferences.
- Expand C/C++, expand Editor 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 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 template displays in the Templates list.
To edit a template:
- Click Window > Preferences.
- Expand C/C++, expand Editor 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.
Using Content Assist
Importing and exporting templates