You can generate a plug-in project from a template.
Procedure
- Open the Plug-in Development perspective.
- On the main menu of the workbench, click and click Next. The New
Plug-in Project wizard opens.
- In the Project name field of the Plug-in
Project page, enter a name for the new project and click Next.
- In the ID field of the Content page,
enter an ID for the new project and click Next.
- On the Templates page, select Create
a plug-in using one of the templates. Then, select Custom
EGL Code Review Rule and click Next.
- On the EGL Rule Template page, complete
the following fields:
- Rule class
- Enter a fully qualified Java™ class
name. The wizard assigns this name to the class that it creates to
implement the new rule. The default value for this field is the Project
ID followed by the character string EglRule.
Tip: The Project ID is the character string that you specified
in the ID field on the Content page
of the wizard.
- Rule label
- Enter a name for the new rule. This name is added to the list
of available rules that are displayed in the software analysis configuration
window. The default value for this field is "My custom EGL
rule".
- Category
- 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.
- Category ID
- Enter a valid Eclipse ID for the category within which the user-written
custom rule is displayed in the software analysis configuration window.
The default value is the Project ID followed by the word custom.
Tip: The Project ID is the character string that you specified
in the ID field on the Content page
of the wizard.
- Category name
- Enter a name for the category within which the user-written rule
is displayed in the software analysis configuration window. The default
value is Custom.
- Expand the Program tree for EGL
and select the language element or elements that the implementation
code for the new rule must check for violations. The default
is that no elements are selected. For an example of
the Java code that is generated
for selected elements, see the link at the end of the topic.
- Click Finish. The
wizard creates a plug-in project for the new user-written rule, adds
the project to the Package Explorer view, and
opens the manifest file in the plug-in manifest editor.
- If you did not already open the Plug-in Development perspective,
open it when prompted.
- Close the plug-in manifest editor.
Results
The EGL
Rule Template page of the wizard
adds rule and category extensions to the
plugin.xml file
that is generated for the custom rule plug-in project. See
Generated files: Rule and category extensions.
The wizard also generates a Java class for implementing a user-written rule. See
the related links at the end of the topic.