IBM Rational Performance Tester SDK

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

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.jface.action.AbstractAction
          extended by org.eclipse.jface.action.Action
              extended by com.ibm.rational.test.lt.recorder.ui.actions.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().


Field Summary
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
AbstractAnnotationAction(String text, ImageDescriptor image)
          Instantiates a new annotation action.
AbstractAnnotationAction(String text, int hotkeyModifier, int hotkeyValue)
          Instantiates a new annotation action.
 
Method Summary
protected  boolean canEmitAnnotation()
          Determines whether an annotation can be emitted at this time.
 void dispose()
          Disposes any control/resource allocated by this action.
 IRecorder getAnnotationRecorder()
          Returns the annotation recorder where any annotation emitted by this action should be sent.
protected  IAnnotationStateHandler getAnnotationStateHandler(String annotationType)
          Returns the state handler for the specified annotation type.
 Shell getShell()
          Returns the shell that should be used as parent shell to any new window created by the action.
protected  void recorderChanged()
          Allows the action to initialize its state once it is connected to the annotation recorder.
 void registerHotkey()
          Register the associated system-level hotkey if non-zero
 void setAnnotationRecorder(IRecorder recorder)
          Sets the annotation recorder where any annotation emitted by this action should be sent.
 void setShell(Shell shell)
          Sets the shell that should be used as parent shell to any new window created by the action.
 void unregisterHotkey()
          Unregister the associated system-level hotkey if non-zero
 void update()
          Updates the enablement of this action.
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, removePropertyChangeListener
 

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().


getAnnotationRecorder

public IRecorder getAnnotationRecorder()
Returns the annotation recorder where any annotation emitted by this action should be sent. This implementation returns the recorder that was set in AbstractAnnotationAction.setAnnotationRecorder(IRecorder).

Returns:

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:

update

public void update()
Updates the enablement of this action. This implementation invokes AbstractAnnotationAction.canEmitAnnotation() and updates enablement accordingly.


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. 2012. All rights reserved.