Chapter 2 Resource Editor Reference Guide


Options category

The Options category allows you to customize the generation process. It contains default entries that represent options for generation. You can define generation options, these are available after creation in the Options page of the Generation dialog box.

Generation options can be used in all templates.

You can create the following types of options:

Type Description
Boolean When selected, a Value box allows you to choose between Yes and No
String When selected, a Value box allows you to enter the string
List When selected, a Value area appears. You can add a value using the Add a Value tool, then check the value check box

The option's comment appears in the Options page of the Generation dialog box instead of the option's name because the comment is usually more understandable than the name. However, the name is evaluated by GTL.

Steps To define an option for generation:

  1. Right-click the Generation\Options category and select New.

    The new entry appears with a default name.
  2. Type a name in the Name box.
  3. Select a type.
  4. Type a comment in the Comment box, this comment will be used in the Options page of the Generation dialog box.
  5. Depending on the option type, select or type the value in the Value area.
  6. Click Apply.

Example 1

Open the object language from Language→Edit Current Object Language, and create a boolean entry named UserDefined_Option in the Generation\Options category:


The new option is available in the Options page of the Generation dialog box from Language→Generate Java Code. The comment of the option is displayed by default. If no comment has been provided, then the name of the option is displayed.


Example 2

The value of an option may be accessed in a template using the following syntax:

'%' 'GenOptions.'<option-name> '%'

For example, if you define a boolean option named GenerateComment, %GenOptions.GenerateComment% will evaluate to either true or false in a template, depending on the value specified in the Options page of the Generation dialog box.

Removing a generation option

You can remove a generation option in the resource file by right-clicking the entry and selecting Remove. A confirmation dialog box asks you to confirm the entry deletion. It may indicate that the default value set for this entry will be used, this default value is stored in the hidden template of the resource file.

For more information on these entries, see section Adding a category or an entry to a resource file.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.