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
- Start by creating the class that is used with the
parameterValidatorextension point. This class is responsible for checking to make sure the value that is entered into the
valueparameter follows the specifications that are outlined in this sample. In the Package Explorer view, right click the
com.ibm.carma.plugin.howtoplug-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.actionpackage 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.actionpackage 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.