Use the Templates page of the Editor Options dialog box to view existing code templates. With JBuilder Professional 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. You can use code templates in the editor to speed 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. See Tools|Editor Options|Templates for the template names.The editor automatically expands the template.
JBuilder's pre-defined code templates are formatted according to your project preferences. These options are set in the following locations:
Important: For Professional and Enterprise users, when you modify and create templates, JBuilder does not format according to these preferences. You must set the braces and block indent manually.
Templates are read-only in JBuilder Personal.
The existing code templates. Choose a template to see its expansion in the Code box at the bottom of the dialog box.
Code templates are editable in JBuilder Professional 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 Professional and Enterprise.
Displays the Edit Code Template dialog box where you edit the name and description of the selected template.
Code templates are editable in JBuilder Professional and Enterprise.
Deletes the selected template.
The code in the template.
Use the pipe character, '|', to denote the caret position after the template is expanded.
In the following sample code template, the cursor will position to one blank space after the if keyword when the template is expanded:
if (|) { } else { }
Restores the original contents of the method, deleting all edits in the current session.