Adding a rule to an existing rule plug-in project

You can add a user-written rule to an existing custom-rule project.

About this task

After you generate a plug-in project for a user-written rule, you can add other user-written rules to the same project.

Procedure

To add a user-written rule to an existing plug-in project:

  1. Open the Plug-in Development perspective.
  2. In the Package Explorer view, expand the user-written rule plug-in project to which you want to add a rule.
  3. Right-click plugin.xml and click Open With > Plug-in Manifest Editor.
  4. On the Extensions tab of the editor, click Add. The New Extension wizard opens.
  5. In the left pane of the Extension Wizards tab, click Code Review Templates and then in the right pane click Custom COBOL Code Review Rule or Custom PL/I Code Review Rule.
  6. Click Next.
  7. In the Rule class field, enter a rule class name for the new rule. Depending on your plug-in, you might want the new rule class name to indicate how the new class is related to existing classes in the plug-in. For example, rule classes for the Data division might be named datadivision.rule0001 and datadivision.rule0002
  8. In the Rule label field, enter a label for the new rule.
  9. You can create a rule category for the new rule or you can add the new rule to an existing built-in or custom rule category.
    • To place the new rule into a new rule category, click Create a new category and enter a category ID and category name for the new category.
    • To add the rule to an existing category, click Select an existing category, then expand the list and select the category to which you want to add the new rule.
  10. Expand the Program tree and select the COBOL or PL/I language elements that the implementation code for the new rule must check for violations. The default is that no elements are selected.
  11. Click Finish. A source code file is generated for the new class, and the plugin.xml file is updated with an extension for the new rule. For more information about the resources that are generated for a plug-in, see the links at the end of the topic.
  12. In the plug-in manifest editor, save the new state of the plug-in.

What to do next

If the plug-in is installed into the development workbench environment, then you must update the feature, the update site, and the development workbench environment to install the new rule. For information about these tasks, see the links at the end of the topic.

Feedback