com.ibm.rational.test.lt.recorder.ui.actions

Class AbstractAnnotationAction

  • All Implemented Interfaces:
    IAction


    public abstract class AbstractAnnotationAction
    extends Action
    This abstract class can be extended by clients to define an action that adds a new annotation to a recording session. The action may appear at several places in the recording framework UI. Both a label and an image are required on the action. Annotation actions must be declared using the extension point com.ibm.rational.test.lt.recorder.ui.annotationContribution. Implementations must implement Action.run(), and may override AbstractAnnotationAction.canEmitAnnotation().
    • Constructor Detail

      • AbstractAnnotationAction

        public AbstractAnnotationAction(String text,
                                int hotkeyModifier,
                                int hotkeyValue)
        Instantiates a new annotation action.
        Parameters:
        text - The action label.
        hotkeyModifier - The bitwise combination of modifiers
        hotkeyValue - The hotkey value. 0 means none.
      • AbstractAnnotationAction

        public AbstractAnnotationAction(String text,
                                ImageDescriptor image)
        Instantiates a new annotation action.
        Parameters:
        text - The action label.
        image - The action icon.
    • Method Detail

      • getShell

        public Shell getShell()
        Returns the shell that should be used as parent shell to any new window created by the action. This implementation returns the shell that was passed by the framework to AbstractAnnotationAction.setShell(Shell).
        Returns:
        A shell.
      • setShell

        public void setShell(Shell shell)
        Sets the shell that should be used as parent shell to any new window created by the action. This implementation stores the shell so it can be returned by AbstractAnnotationAction.getShell().
      • setAnnotationRecorder

        public final void setAnnotationRecorder(IRecorder recorder)
        Sets the annotation recorder where any annotation emitted by this action should be sent. This implementation stores the recorder so it can be returned in AbstractAnnotationAction.getAnnotationRecorder(). Sub-classes must invoke the super implementation of this method if it overridden.
        Parameters:
        recorder -
      • recorderChanged

        protected void recorderChanged()
        Allows the action to initialize its state once it is connected to the annotation recorder. This is the place to retrieve an annotations state handler, if any. The default implementation does nothing.
      • canEmitAnnotation

        protected boolean canEmitAnnotation()
        Determines whether an annotation can be emitted at this time. This implementation returns true provided that the annotation recorder is active. Sub-classes must invoke the super implementation of this method if it overridden.
        Returns:
      • getAnnotationStateHandler

        protected final IAnnotationStateHandler getAnnotationStateHandler(String annotationType)
                                                                   throws UnsupportedPropertyException
        Returns the state handler for the specified annotation type. State handlers are an optional feature that enable orchestrating enablement and state management of annotations.
        Parameters:
        annotationType - An annotation type
        Returns:
        The state handler that manages state of the specified annotation type, or null if the annotation type has no state handler.
        Throws:
        UnsupportedPropertyException - If the annotation type does not exist.
      • dispose

        public void dispose()
        Disposes any control/resource allocated by this action. This implementation does nothing.
      • registerHotkey

        public void registerHotkey()
        Register the associated system-level hotkey if non-zero
      • unregisterHotkey

        public void unregisterHotkey()
        Unregister the associated system-level hotkey if non-zero
IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2013. All rights reserved.