Creating and editing templates

Content Assist uses templates to enable you to quickly make use of commonly used code segments.

To create a template:

  1. Click Window > Preferences.
  2. Expand C/C++, expand Editor and select Templates.
  3. Click New.


    Creating a new Code Template Window


  4. 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.
  5. Click OK.
    The new template displays in the Templates list.

To edit a template:

  1. Click Window > Preferences.
  2. Expand C/C++, expand Editor and select Templates.
  3. Click Edit. The Edit Template dialog opens.


    Editing a Code Template


  4. 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.
  5. Click OK.

Related concepts
Content Assist

Related tasks
Using Content Assist
Importing and exporting templates

Related reference
Templates page

QNX Copyright Statement