You can edit class templates though the Templates view.
If necessary, open the Templates view:
From the menubar, select Window > Show View > Templates or
Window > Show View > Other... > Together Patterns > Templates.
The Templates view opens.
Right click on a template in the Java Class templates section, and select Open.
The class template editor opens.
The Description you enter is the text that appears in the description pane of the Apply Pattern dialog when you select this template. (See Creating Patterns for more information.) The description text area supports basic html tags to format the text. The help context id field can be used to enter an id to link to a help page that may further describe the template. Check the Applicable only to interface option to specify a template that is only applicable to an interface:
Variables can be used to specify text in the code that the template generates:
Or for use as names that appear on the various tabs.
On the Variables tab, you can specify:
TIP: Double-click on an existing variable or click Edit to open the Edit Variable dialog. Clicking Add opens the New Variable dialog. To select the variable type, the Variable Type field provides code completion and a drop down list.
Two default variables come as standard but are not displayed on this tab:
${methodName} ${fieldName}
Use the "Add" and "Remove" buttons to add any imports you want generated when this class template is applied.
You can add the full import statement, for instance, javax.swing.JFrame, or javax.swing.*
On this tab, you create the attributes to be generated by the template:
Use the "Add" button to open the New Attribute dialog. Enter a name to add it to the list box and new code to the snippet field. Use the "Delete" button to delete a selected attribute from the list. Click the "Variable..." button to create code snippets.
The area below the list is used to enter syntax and any comments.
As you select the different fields in the list, the area displays their syntax. You can also use conditional statements based upon the variables you create in the Variables tab.
For more on acceptable template editor syntax, see Using Syntax and Conditions in Templates.
Similar to the Attributes tab, use the Operations tab to specify the list of operations to be created by the template:
Use the "Add" button to add new operations. Use the "Delete" button to delete a selected operation in the list.
The area below the list is used to enter the syntax and any comments.
As you select the different operations in the list, the area displays their syntax. You can also use conditional statements to control what the template generates when applied to a class, based upon the variables you create in the Variables tab.
For more on acceptable template editor syntax, see Using Syntax and Conditions in Templates.
Template changes need to be saved before they can be applied. To save your
template, select File > Save <template name> from the menubar.
Related Topic: