Customize the Code Generators

The code generators supplied with NaturalONE use Velocity templates, which are embedded in the .jar file created during the build process. To customize the templates, you can copy the embedded templates from the .jar file to your custom-templates folder and modify the template there. Velocity will check this folder first for the template. If it exists, it will be used by the code generator.

This section describes how to customize the code generators. The following topics are covered:


Export the Supplied Templates

Start of instruction setTo export the supplied templates

  1. Select Export on the File menu.

    The Export window is displayed.

  2. Expand the Software AG root node.

  3. Select Code Generation Templates.

    For example:

    graphics/export-window.png

  4. Select Next.

    The Select Templates for Export panel is displayed. For example:

    graphics/export-templates-window.png

    This panel displays the default target folder for the templates, as well as the templates available for export.

    Note:
    You can change the default target folder in the Preferences window for Code Generation. For information, see Set Code Generation Preferences.

  5. Select the templates you want to export.

    • To select all templates in a template node, select the node (for example, if you select the Common Templates root node, all templates within that node will be selected).

    • To select individual templates, expand a template root node and select the template.

      For example:

    graphics/export-templates-window-subnodes.png

  6. Select Finish.

    The templates are exported to the selected target folder.

    Note:
    You cannot change the functionality of the internal Java code, you can only modify the templates.

Customize a Supplied Template

Start of instruction setTo customize a template

  1. Select the template in the custom-templates > cst folder.

    For example:

    graphics/custom-templates-in-explorer.png

    Note:
    Custom templates are stored in the folder specified in the Preferences window for Code Generation. For information, see Set Code Generation Preferences.

  2. Open the template you want to modify.

    For example:

    graphics/edit-template.png

  3. Modify the template.

  4. Save the changes.