Lesson 6: Create the appropriate Java classes to handle the verification and validation
In the previous lessons you configured the extension points; now you create the Java™ classes that are needed to handle the validation of the parameters and actions.
About this task
Tip: As you create these Java classes, they will each have to implement
or extend certain interfaces or classes respectively. To determine
what classes or interfaces need to be included, you can right-click
on the extension in the Plug-in Editor and
select Show Description. The description of
the extension will open in the editor. If you scroll down to the API
Information heading, you find the classes or interfaces
the class needs to use in conjunction with the extension point.
Procedure
- Start by creating the class that is used with the
parameterValidator
extension point. This class is responsible for checking to make sure the value that is entered into thevalue
parameter follows the specifications that are outlined in this sample. In the Package Explorer view, right click thecom.ibm.carma.plugin.howto
plug-in project, and select New > Package. - In the New Java Package dialog box that opens, enter com.ibm.carma.plugin.howto.action as the name for the package. Click Finish. You should see the package that is created under your Eclipse plug-in project.
- Now, right click the
com.ibm.carma.plugin.howto.action
package you created, and select New > Class. The New Java Class dialog box opens. - Enter ValueParamValidator in the Name text field.
- To the right of the Interfaces click the Add button. In the Implemented Interfaces Selection dialog box that opens, filter for the interface IParameterValidator. Click Finish to close the New Java Class dialog box and open the class in the editor.
- Now, you create the second Java class
that is responsible for handling the verification of the HowTo action.
Right click the
com.ibm.carma.plugin.howto.action
package and select New > Java Class. - In the New Java Class dialog box that opens enter the name of the class to be, ActionValidator and add the interface IActionValidator. Click Finish to close the dialog box and create the class.
- Finally, create the last Java class
following the above steps and by defining a name of
CheckboxOptionControl
. Click the Browse button to the right of the Superclass text field. The Superclass Selection Dialog Box should open. Filter for the class,AbstractCustomParameterControl
, select it, and click OK. - Click Finish to close the New Java Class dialog box and open the class in the editor.