Creating Live Templates
From RAD Studio
Go Up to How To Edit Code in the Code Editor
While using the Code Editor, you can add your favorite code constructs to the Template Manager to create a library of the templates you use most often.
To add a Live Template using the Menu Commands
- While you are working in the Code Editor, choose File > New > Other > Other Files and then select the Code Template icon.
- Fill in the template name, description, author, and code language attributes. Then type in the code for your template between the <![CDATA[]]> tag and the </code> tag. The
Nameand Language fields in the template are required. - Choose the Save command from the File pull-down menu in the Code Editor (or type
CTRL + S). Your new template now appears in the IDE tree of the Template Manager window. It is saved, by default, into the \<n.n>\Objrepos\code_templates\ directory.
To add a Live Template using the Template Manager window
- In the Code Editor, choose View > Templates.
- In the Template Manager window, click the New button. This will put an XML outline for a code template in the Code Editor main window. You can also select code in the editor before you click the New button.
- Fill in the template name, description, author, and code language attributes. Then type in the code for your template between the <![CDATA[]]> tag and the
</code>tag. TheNameandLanguagefields in the template are required. - Choose the Save command from the File pull-down menu in the Code Editor (or type
CTRL + S). Your new template now appears in the IDE tree of the Template Manager window. It is saved, by default, in the\<n.n\Objrepos\code_templates\directory.