Defining a new annotation type

Each annotation type has its own semantics and supports a set of properties.

To define a new annotation type, complete these procedures:

  • Declare a new annotation type in the plugin.xml file by using the com.ibm.rational.test.lt.recorder.core.recorderAnnotation extension point and the annotationType element.
  • Assign the type a unique ID. Typically the ID is in this form: pluginName.type.
  • Assign a user-readable name to the type. The name is visible in the recording session editor.

For best results, complete these optional steps:

  • Define an interface that contains a string constant with the annotation type ID defined earlier.
  • In this interface, include a string constant for each property name that the annotation type supports. Specify the meaning and the type of the property in the constant Javadoc information. Property types can be those that are supported by setters and getters of the com.ibm.rational.test.lt.recorder.core.property.AbstractConfiguration class.

Also, define a label provider for the annotation type. A label provider returns a dynamic label that is based on the annotation properties and an image. The label and the icon are visible in the recording session editor. To define a label provider, complete these procedures:

  • Declare a new annotation label provider in the plugin.xml file by using the com.ibm.rational.test.lt.recorder.ui.annotationContribution extension point and the annotationLabelProvider element.
  • Specify the annotation type that the label provider supports.
  • Define an implementation class of the label provider. The implementation class must implement the JFace ILabelProvider interface. Any object passed to this interface is always an instance of the com.ibm.rational.test.lt.recorder.core.annotations.RecorderAnnotation class.