This topic describes how to add a user-written
custom rule to an existing custom-rule project.
After you have generated a plug-in project for a
user-written custom rule, you can add other user-written custom rules
to the same project. If the plug-in has already been installed into
the Developer for System z® environment,
then you will need to update the feature, the update site, and the
Developer for System z environment
to install the new rule. See Installing a user-written custom rule plug-in.
To add a user-written rule to an existing plug-in project:
- Open the Plug-in Development perspective if it is not already
open.
- In the Package Explorer view, expand the user-written custom rule
plug-in project to which you want to add a new rule.
- Right-click plugin.xml and click .
- In the editor, click the Extensions tab.
- Click Add. The New Extension wizard opens.
- On the first page of the wizard:
- Click the Extension Wizards tab.
- In the left pane click Code Review Templates and
then in the right pane click Custom COBOL Code Review Rule.
- Click Next.
- On the second page of the wizard:
- In the Rule class field enter a rule class
name for the new rule.
Note: Depending on your plug-in, you probably
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, datadivision.rule0002,
and so on.
- In the Rule label field enter a label for
the new rule.
- You can create a new 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.
- Expand the Program tree and select the
COBOL language element or elements that the implementation code for
the new rule needs to check for violations. The default is no elements
selected.
- Click Finish.
A source code file is generated for the new class, and the plugin.xml
is updated with an extension for the new rule. See Generating a plug-in project for a user-written custom rule.
- In the plug-in manifest editor, save the new state of the plug-in.