Creating a plug-in for the rule

To create your own quality control rule, you must first create a plug-in that contains all the components of the rule. Templates are supplied for rules specific to Rational Programming Patterns.

Before you begin

To implement your rule, you must be in the Plug-in Development perspective.

Procedure

  1. Select in the menu the choice File > New > Project…
    In the window that opens up, select Plug-in Project in the section Plug-in Development. Then click Next to open the creation wizard.
    Figure 1. Selecting the Plug-in Project
    Selecting the Plug-in Project
  2. In the Plug-in Project page of the wizard, enter a Project name and click Next until you arrive on the Templates page.
    Figure 2. Plug-in Project wizard
    Plug-in Project wizard

    The Templates page displays on the left side all the available templates. The templates specific to Rational Programming Patterns are prefixed by "RPP". You can select a template for a rule or a template for a rule template.

    On the right side of the wizard, you can read explanations about the selected template and the extension used.

    Figure 3. Plug-in templates
    Plug-in templates
  3. Select a template and click Next.

    The next page contains the properties of the rule and you can modify the fields to customize the rule. The content of this page varies depending on the template

    Figure 4. Properties of the rule
    Properties of the rule
    To familiarize yourself with the tool, you can keep as a first step the default values and click Finish.
    Note: If you're comfortable with Eclipse, you can modify the properties of the rule, give a new Java Class name for example that corresponds to your control and adapt the other parameters. You will also have to modify the Java class to realize the control you want.

    When the plug-in project is created, its components are added in the Package Explorer and the plug-in editor opens up.

    In the Extensions tab (corresponding to the content of the plugin.xml file), you can see the extension you need to extend to add a rule to you workspace. The tab also displays the properties of the rule with the default values set in the creation wizard of the plug-in.

    Figure 5. Extensions of the Plug-in
    Extensions of the Plug-in

    In the plug-in components, you can see the Java class that executes the quality control. The code is quite simple and gives an example of using the Rational Programming Pattern API. You can use these classes to start. For experienced people, you can modify the code and customize it to create your own rules.

    Figure 6. Plug-in components
    Plug-in components

    For a complete information on the plug-in creation, consult the sections "Reference > Wizards and Dialogs > New Project Creation Wizards" and "Reference > Editors" in the Plug-in Development Environment (PDE) User Guide of Eclipse documentation.


Feedback