TPTP 4.4.0 Testing Tools Project
Internal API Specification

org.eclipse.tptp.test.auto.gui.internal.commands
Class AbstractMacroCommand

java.lang.Object
  extended byorg.eclipse.tptp.test.auto.gui.internal.macro.AbstractMacroInstruction
      extended byorg.eclipse.tptp.test.auto.gui.internal.commands.AbstractMacroCommand
All Implemented Interfaces:
IMacroCommand, IMacroInstruction, IPlayable, IWritable
Direct Known Subclasses:
AbstractStructuredCommand, BooleanSelectionCommand, ChoiceSelectionCommand, CloseWorkbenchPartCommand, FocusCommand, ModifyCommand, PositionBasedCommand, VerificationCommand, WaitCommand

public abstract class AbstractMacroCommand
extends AbstractMacroInstruction
implements IMacroCommand

An abstract implementation of IMacroCommand. Contributors can subclass this class or provide a direct implementation of IMacroCommand.


Field Summary
protected static int DESCRIPTIVE_FIELD_BOUND
          The bound for the value of descriptive fields
 
Constructor Summary
AbstractMacroCommand(MacroCommandShell parent, WidgetIdentifier widgetId)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  void findDescriptiveField(java.lang.Object[] objects)
          Similar to initializeDescriptiveField(Widget), but the descriptive field is a comma-separated string of all the descriptive fields that corresponds to the objects passed in.
protected  void findDescriptiveField(org.eclipse.swt.widgets.Widget widget)
          Initializes the descriptive field of this command based on the value returned by the getText() method of the widget (if it has one)
 java.lang.String getDescriptiveField()
          Returns the descriptive field of this command.
protected  java.lang.String getObjectClassName(java.lang.Object object)
          Returns the class name of the object passed in (excluding the package name) This is useful for adding a descriptive field to the command
 MacroCommandShell getParent()
          Returns the parent of this command.
protected  java.lang.String getText(java.lang.Object obj)
           
 long getTimeDifference()
           
 boolean isRepeatRedundant()
          Should return false if executing this command just after it has already been executed will have a different output.
 void load(org.w3c.dom.Node node, java.util.Hashtable lineTable)
          Invoked to load the macro instruction based on its corresponding XML node.
 boolean mergeEvent(org.eclipse.swt.widgets.Event e)
          If this command occurs consecutively, then this method gives this command a chance to merge mutliple commands together to reduce the overhead.
 void setDescriptiveField(java.lang.String descriptiveField)
          Set the descriptive field of this command.
 void setParent(MacroCommandShell parent)
          Sets the parent of this command.
 void setTimeDifference(long timeDifference)
           
 java.lang.String toString()
           
 void write(int indent, java.lang.StringBuffer sb)
          Equivalent to write(indent, writer, false, false)
 void write(int indent, java.lang.StringBuffer sb, boolean close, boolean end)
          Writes the common fiels of this command
 void writeFinish(int indent, java.lang.StringBuffer writer)
          Invoked in the end of the write of a writable object
 void writeStart(int indent, java.lang.StringBuffer writer)
          This is our chance to write any artificial wait commands if the option is enabled.
 
Methods inherited from class org.eclipse.tptp.test.auto.gui.internal.macro.AbstractMacroInstruction
bindSourceLocation, getCorrespondingObject, getStartLine, getStopLine, getWidgetId, setCorrespondingObject, setWidgetId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.tptp.test.auto.gui.internal.commands.IMacroCommand
getType, processEvent
 
Methods inherited from interface org.eclipse.tptp.test.auto.gui.internal.core.IMacroInstruction
getCorrespondingObject, getStartLine, getStopLine, getWidgetId, setCorrespondingObject, setWidgetId
 
Methods inherited from interface org.eclipse.tptp.test.auto.gui.internal.core.IPlayable
playback
 

Field Detail

DESCRIPTIVE_FIELD_BOUND

protected static final int DESCRIPTIVE_FIELD_BOUND
The bound for the value of descriptive fields

See Also:
Constant Field Values
Constructor Detail

AbstractMacroCommand

public AbstractMacroCommand(MacroCommandShell parent,
                            WidgetIdentifier widgetId)
Constructor

Parameters:
parent - The parent command shell
widgetId - The associated widget id
Method Detail

load

public void load(org.w3c.dom.Node node,
                 java.util.Hashtable lineTable)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IMacroInstruction
Invoked to load the macro instruction based on its corresponding XML node.

Specified by:
load in interface IMacroInstruction
Overrides:
load in class AbstractMacroInstruction
Throws:
org.eclipse.core.runtime.CoreException
See Also:
IMacroInstruction.load(org.w3c.dom.Node, java.util.Hashtable)

mergeEvent

public boolean mergeEvent(org.eclipse.swt.widgets.Event e)
Description copied from interface: IMacroCommand
If this command occurs consecutively, then this method gives this command a chance to merge mutliple commands together to reduce the overhead.

Specified by:
mergeEvent in interface IMacroCommand
Returns:
true if the command is merged; false otherwise.

getDescriptiveField

public java.lang.String getDescriptiveField()
Returns the descriptive field of this command.

Specified by:
getDescriptiveField in interface IMacroCommand
Returns:
The descriptive field of this command.

setDescriptiveField

public void setDescriptiveField(java.lang.String descriptiveField)
Set the descriptive field of this command. The descriptive field is used to more easily identify the semantics of a command.

Specified by:
setDescriptiveField in interface IMacroCommand
Parameters:
descriptiveField - The descriptive field (can be a button's text, a tree item label, or etc...)

findDescriptiveField

protected void findDescriptiveField(org.eclipse.swt.widgets.Widget widget)
Initializes the descriptive field of this command based on the value returned by the getText() method of the widget (if it has one)

Parameters:
widget - The widget

findDescriptiveField

protected void findDescriptiveField(java.lang.Object[] objects)
Similar to initializeDescriptiveField(Widget), but the descriptive field is a comma-separated string of all the descriptive fields that corresponds to the objects passed in.

Parameters:
objects - The objects

getText

protected java.lang.String getText(java.lang.Object obj)

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object obj)

getParent

public MacroCommandShell getParent()
Description copied from interface: IMacroCommand
Returns the parent of this command.

Specified by:
getParent in interface IMacroCommand
Returns:
The parent

setParent

public void setParent(MacroCommandShell parent)
Description copied from interface: IMacroCommand
Sets the parent of this command.

Specified by:
setParent in interface IMacroCommand
Parameters:
parent - The parent

isRepeatRedundant

public boolean isRepeatRedundant()
Should return false if executing this command just after it has already been executed will have a different output. (e.g. If two focus commands that are identical are redundant but two button selections are not)

Specified by:
isRepeatRedundant in interface IMacroCommand
Returns:
A flag indicating if repeats of this command are redundant.

writeStart

public void writeStart(int indent,
                       java.lang.StringBuffer writer)
This is our chance to write any artificial wait commands if the option is enabled.

Specified by:
writeStart in interface IWritable
Parameters:
indent - The current indent that the command should be at
writer - The writer used to write the macro

write

public void write(int indent,
                  java.lang.StringBuffer sb)
Equivalent to write(indent, writer, false, false)

Specified by:
write in interface IWritable
Parameters:
indent - The indents
sb - The buffer that the string serialization should be written to

write

public void write(int indent,
                  java.lang.StringBuffer sb,
                  boolean close,
                  boolean end)
Writes the common fiels of this command

Parameters:
indent - The current indent that the command should be at
close - A flag that indicates whether the command fragment should be closed (i.e.adding "/" to the end).
end - A flag that indicates whether the command fragment should end (i.e.adding "/" to the end).

writeFinish

public void writeFinish(int indent,
                        java.lang.StringBuffer writer)
Description copied from interface: IWritable
Invoked in the end of the write of a writable object

Specified by:
writeFinish in interface IWritable
Parameters:
indent - The indents
writer - The buffer that the string serialization should be written to

getTimeDifference

public long getTimeDifference()

setTimeDifference

public void setTimeDifference(long timeDifference)

getObjectClassName

protected java.lang.String getObjectClassName(java.lang.Object object)
Returns the class name of the object passed in (excluding the package name) This is useful for adding a descriptive field to the command

Parameters:
object - The object
Returns:
The object class name

TPTP 4.4.0 Testing Tools Project
Internal API Specification