Creating a plug-in project to declare a generator

To add an execution code generator, you can extend the appropriate generator class to modify the behavior of an existing generator. You do so after you create a plug-in project to declare the new generator.

About this task

To modify the behavior of an existing generator or create a generator, create a plug-in project to declare your generator.

Procedure

To create a plug-in project to declare your generator:

  1. Create a Java™ class to generate the files in the new project.

    For more information about how to write this class, see Writing a new code generator class.

  2. Declare the class as a new generator by adding it as a new extension managed by the plug-in, as follows:
    1. Double-click the plugin.xml file of your plug-in project.
    2. On the Extension page, click Add and create an extension entry of type ilog.rules.studio.res.generator.
    3. Add a generator to the new extension by selecting New > Generator in the contextual menu on the ilog.rules.studio.res.generator.
      In the extension, you can create a generator, a category, or a primary generator.
      • Use the generator element to declare a generator.
      • Use the category element to define the categories that are used in the generator declaration to group the generators.
      • Use the primary generator element to declare a generator as a primary generator outside the categories.

      If no categories are defined, or if the category definition is incorrect, the generator is assigned to the Other category.

    4. For the new generator, complete the extension element details as follows:
      name
      The name of your generator as shown in the wizard.
      id
      A unique ID (in Eclipse) that references your generator.
      description
      The text that describes your generator in the wizard.
      class
      The Java class that you previously created.
      pageid
      Enter the page identifiers as follows:
      • Enter ilog.rules.studio.res.generator.generatorChooserPage to see your generator in the Client Project for RuleApps wizard and the Artifacts for RuleApps wizard.
      • Enter ilog.rules.studio.res.generator.generatorChooserPage.create to see your generator only in the Client Project for RuleApps wizard.
      • Enter ilog.rules.studio.res.generator.generatorChooserPage.complete to see your generator only in the Artifacts for RuleApps wizard.
      enabled
      Set it to true to view your generator in the wizard.
      wizard
      The nested wizard of the generator. It is displayed after the creation wizard or after the completion wizard.
      creationWizardClass
      The pages to use instead of the Client Project for RuleApps wizard default pages: the destination project, the RuleApp project that is used as source, and the ruleset to manage in the RuleApp project.
      creationWizardPlugin
      The name of the plug-in where the creationWizardClass can be found. By default it is the plug-in where the generator is defined.
      completionWizardClass
      The pages to use instead of the default pages in the Artifacts for RuleApps wizard: the destination project, the RuleApp project that is used as source, and the ruleset to manage in the RuleApp project.
      completionWizardPlugin
      The name of the plug-in where the completionWizardClass can be found. By default, this is the plug-in where the generator is defined.
    5. On the Dependencies page, you must at least add the ilog.rules.studio.res plug-in and the ilog.rules.studio.res.ui plug-in if you redefine a wizard.