Home

 

Code snippets

RAD v7.5 provides the ability to create code snippets that contain commonly used code to be inserted into files rather than typing the code in every time.

To create code snippets, do these steps:

Open the Snippets view by selecting Window | /b>Æ Show View Æ Other, and in the Show View dialog expand the General folder, select the Snippets view, and click OK.

Right-click the Snippets view and select Customize (Figure | 5-4).

Figure 25-4 Customizing snippets

In the Customize Palette dialog, select New Æ New Category.

In the New Customize Palette dialog (Figure | 5-5), do these steps:

Name: Ant
Description: Ant Snippets
Select Custom.
Click Browse next to Custom, select Ant Buildfiles for Content Type Selection, and click OK to return to the Customize Palette dialog.

Figure 25-5 New Customize Palette dialog

In the Customize Palette dialog, select New Æ New Item.

In the Unnamed Template dialog, enter the following items:

Name: Comment Tag
Click New in the variables section
Variable Name: comment
Template Pattern: <!-- ${comment} -->

Click OK in the Customize Palette dialog.

The Ant category with the Comment Tag entry is added to the Snippets view.
ibm.com/redbooks