This topic describes the rule and category extensions that
the COBOL Rule Template wizard adds to the plugin.xml file that is
generated for the custom rule plug-in project.
The new plugin.xml file contains extensions to register the new
custom rule and its category with Eclipse.
Figure 1 shows
the extension for a custom rule:
Figure 1. Extension
for a custom rule<extension
point="com.ibm.rsaz.analysis.core.analysisRule">
<analysisRule
category="category_id"
class="rule_class"
id="rule_class"
label="rule_label"
severity="1">
</analysisRule>
</extension>
Also the extension for the category is added to the plugin.xml
file if the category does not already exist.
Figure 2 shows
the extension for a category:
Figure 2. Extension
for the category of a custom rule<extension
point="com.ibm.rsaz.analysis.core.analysisCategory">
<analysisCategory
class="com.ibm.rsaz.analysis.core.category.DefaultAnalysisCategory"
id="category_ID"
label="category_name"
provider="codereview.cobol.analysisProvider">
</analysisCategory>
</extension>
Table 1 shows
how the attributes of the <analysisRule> and the <analysisCategory>
elements are derived from the values that were entered on the pages
of the Plug-in Project wizard:
- In the <analysisRule> element the category, ruleclass, ruleid,
and rulelabel attributes are set to the values that
you entered on the COBOL Rule Template page of the wizard. The value
specified for the rule class is also used to set the rule id.
- In the <analysisCategory> element the id and label attributes
are set to the values entered on the COBOL Rule Template page.
- The package name, shown in the Example column
as com.example, is set to the string that was specified
in the ID field of the package definition,
on the Content page of the New Plug-in Project wizard.
Table 1. Attributes of analysisRule
and analysisCategory| Attribute: |
Input field on the COBOL Rule Template wizard
page: |
Example: |
| analysisRule.category |
Category ID |
com.example.custom |
| analysisRule.ruleclass |
Rule class |
com.example.CobolRule |
| analysisRule.ruleid |
Rule class |
com.example.CobolRule |
| analysisRule.rulelabel |
Rule label |
My custom COBOL rule |
| analysisCategory.id |
Category ID |
com.example.custom |
| analysisCategory.label |
Category name |
Custom |