Use the Templates page of the Editor Options dialog box to view existing code templates. With JBuilder SE and Enterprise editions, you can also add, edit and delete code templates.
Code templates are snippets of frequently used code elements that you can insert into your code to save repetitive typing. This speeds up the coding process.
To use a code template in your code, select one of these methods:
classp
, in your code where you want the code to appear and press Ctrl+J. The editor automatically expands the template.
JBuilder's pre-defined code templates are inserted into the code according to the formatting specified in your project preferences. These options are set in the following locations:
Important: For SE and Enterprise users, when you modify and create templates, JBuilder uses exactly what you type, without changing the formatting to match these preferences. You must set the braces and indentation appropriately when you write the code for the template.
Templates are read-only in JBuilder Personal.
Lists the existing code templates and their descriptions in a table. Choose a template to see its content in the Code box at the bottom of the dialog box.
Code templates are editable in JBuilder SE and Enterprise.
Displays the Add Code Template dialog box where you enter the new code template name and description.
Code templates are editable in JBuilder SE and Enterprise.
Displays the Edit Code Template dialog box where you edit the name and description of the selected template.
Code templates can be changed in JBuilder SE and Enterprise.
Deletes the selected template.
Code templates can be changed in JBuilder SE and Enterprise.
This is the editable pane displaying the code in the template. Type directly in the pane to make changes.
Use the pipe character, '|', to denote the caret position in the expanded template.
In the following example, the code template expands and the cursor appears inside the parentheses after the if
keyword:
if (|) { } else { }
This lets you start by defining the if
statement immediately.
Restores the last saved contents of the method, deleting all edits in the current session.