abbot.editor
Class ScriptEditor

java.lang.Object
  extended byabbot.editor.ScriptEditor
All Implemented Interfaces:
ActionListener, EditorConstants, EventListener, Resolver

public class ScriptEditor
extends Object
implements ActionListener, Resolver, EditorConstants

Costello, the editor for Abbot scripts.

Acts as a resolver, using the currently in-context script as the component resolver.

To add new actions, add the action to the list in initActions, and optionally add it to the menu layout in initMenus. Define a name for it in EditorConstants, and an inner Action class for it which uses that name.


Field Summary
static int KC_INVERT
          Key to use to invert an assertion/wait.
static int KC_WAIT
          Key to use to insert a wait instead of an assertion.
 
Fields inherited from interface abbot.editor.EditorConstants
ACTION_CAPTURE_COMPONENT, ACTION_CAPTURE_IMAGE, ACTION_DYNAMIC, ACTION_EDITOR_ABOUT, ACTION_EDITOR_QUIT, ACTION_EXPORT_HIERARCHY, ACTION_GET_VMARGS, ACTION_INSERT_ANNOTATION, ACTION_INSERT_APPLET, ACTION_INSERT_CALL, ACTION_INSERT_COMMENT, ACTION_INSERT_LAUNCH, ACTION_INSERT_SAMPLE, ACTION_INSERT_SCRIPT, ACTION_INSERT_SEQUENCE, ACTION_INSERT_TERMINATE, ACTION_PREFIX, ACTION_RUN, ACTION_RUN_LAUNCH, ACTION_RUN_SELECTED, ACTION_RUN_TERMINATE, ACTION_RUN_TO, ACTION_SCRIPT_CLEAR, ACTION_SCRIPT_CLOSE, ACTION_SCRIPT_DELETE, ACTION_SCRIPT_DUPLICATE, ACTION_SCRIPT_NEW, ACTION_SCRIPT_OPEN, ACTION_SCRIPT_RENAME, ACTION_SCRIPT_SAVE, ACTION_SCRIPT_SAVE_AS, ACTION_SELECT_COMPONENT, ACTION_SELECT_TESTSUITE, ACTION_STEP_CUT, ACTION_STEP_GROUP, ACTION_STEP_MOVE_DOWN, ACTION_STEP_MOVE_UP, ACTION_TOGGLE_FORKED, ACTION_TOGGLE_SLOW_PLAYBACK, ACTION_TOGGLE_STOP_ON_ERROR, ACTION_TOGGLE_STOP_ON_FAILURE, MENU_CAPTURE, MENU_EDIT, MENU_FILE, MENU_HELP, MENU_INSERT, MENU_TEST
 
Constructor Summary
ScriptEditor()
          Constructs a ScriptEditor with the specified view
 
Method Summary
 void actionPerformed(ActionEvent ev)
          Respond to various components.
 ComponentReference addComponent(Component comp)
          From abbot.Resolver.
 void addComponentReference(ComponentReference ref)
          From abbot.Resolver.
(package private)  void addStep(Step step)
          Insert a new step at the current cursor location.
protected  boolean checkSaveBeforeClose()
          Return true if it's ok to exit.
(package private)  void dispose()
           
 String getComponentID(Component comp)
          Returns null if not found.
 ComponentReference getComponentReference(Component comp)
          From abbot.Resolver.
 ComponentReference getComponentReference(String refid)
          From abbot.Resolver.
 Collection getComponentReferences()
          From abbot.Resolver.
(package private)  Resolver getContext()
           
 String getContext(Step step)
          From abbot.Resolver.
 ClassLoader getContextClassLoader()
          From abbot.Resolver.
 File getDirectory()
          From abbot.Resolver.
 Hierarchy getHierarchy()
          Get the component corresponding to the given reference.
 String getProperty(String name)
          From abbot.Resolver.
 String getUniqueID(ComponentReference ref)
          From abbot.Resolver.
(package private)  void insertApplet()
          Insert an applet step.
(package private)  void insertLaunch()
          Insert a launch step.
(package private)  void insertTerminate()
          Insert a terminate step.
static void main(String[] args)
          Launch the script editor, with an argument of either a test suite class or a script filename.
(package private)  void newScript(File file, boolean copyFixture)
          Create a new script at the given filename, or open it if it already exists.
(package private)  void quit()
          Quit the application.
(package private)  void saveNestedScripts(Sequence seq)
           
static void setDocumentationProperties(String[] action)
          Deprecated. Set the properties for your action directly. Install the given documentation properties, given as an array of four Strings. Add-on classes derived from ComponentTester should invoke this for each exported action. These properties are for use by the editor to better describe the available methods.

 void setProperty(String name, String value)
          From abbot.Resolver.
(package private)  void setScript(String filename)
          Set the current test script.
 void setStatus(String msg)
          Set the contents of the status message.
 void setStatus(String msg, String extended, int type)
          Set the contents of the status message.
static int showConfirmation(String msg)
           
static int showConfirmation(String msg, int opts)
           
static void showError(String msg)
          Global facility for error dialogs.
static void showError(String title, String msg)
          Global facility for error dialogs.
static String showInputDialog(String title, String msg, String initial)
          Global facility for obtaining a user input String.
static void showMessage(String title, String msg)
          Global facility for message dialogs.
static void showWarning(String msg)
          Global facility for warning dialog.
static void showWarning(String title, String msg)
          Global facility for warning dialog.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KC_INVERT

public static final int KC_INVERT
Key to use to invert an assertion/wait.

See Also:
Constant Field Values

KC_WAIT

public static final int KC_WAIT
Key to use to insert a wait instead of an assertion. Use option key on mac, control key anywhere else.

Constructor Detail

ScriptEditor

public ScriptEditor()
Constructs a ScriptEditor with the specified view

Method Detail

actionPerformed

public void actionPerformed(ActionEvent ev)
Respond to various components.

Specified by:
actionPerformed in interface ActionListener

insertLaunch

void insertLaunch()
Insert a launch step.


insertApplet

void insertApplet()
Insert an applet step.


insertTerminate

void insertTerminate()
Insert a terminate step.


setScript

void setScript(String filename)
Set the current test script.


checkSaveBeforeClose

protected boolean checkSaveBeforeClose()
Return true if it's ok to exit.


quit

void quit()
Quit the application.


setStatus

public void setStatus(String msg)
Set the contents of the status message.


setStatus

public void setStatus(String msg,
                      String extended,
                      int type)
Set the contents of the status message.


getComponentID

public String getComponentID(Component comp)
Returns null if not found.


addStep

void addStep(Step step)
Insert a new step at the current cursor location.


newScript

void newScript(File file,
               boolean copyFixture)
Create a new script at the given filename, or open it if it already exists. Optionally copies the fixture from the current script.


saveNestedScripts

void saveNestedScripts(Sequence seq)
                 throws IOException
Throws:
IOException

getContext

Resolver getContext()

getComponentReference

public ComponentReference getComponentReference(String refid)
From abbot.Resolver.

Specified by:
getComponentReference in interface Resolver

getComponentReference

public ComponentReference getComponentReference(Component comp)
From abbot.Resolver.

Specified by:
getComponentReference in interface Resolver

addComponentReference

public void addComponentReference(ComponentReference ref)
From abbot.Resolver.

Specified by:
addComponentReference in interface Resolver

addComponent

public ComponentReference addComponent(Component comp)
From abbot.Resolver.

Specified by:
addComponent in interface Resolver

getUniqueID

public String getUniqueID(ComponentReference ref)
From abbot.Resolver.

Specified by:
getUniqueID in interface Resolver

getComponentReferences

public Collection getComponentReferences()
From abbot.Resolver.

Specified by:
getComponentReferences in interface Resolver

getContext

public String getContext(Step step)
From abbot.Resolver.

Specified by:
getContext in interface Resolver

getDirectory

public File getDirectory()
From abbot.Resolver.

Specified by:
getDirectory in interface Resolver

setProperty

public void setProperty(String name,
                        String value)
From abbot.Resolver.

Specified by:
setProperty in interface Resolver

getProperty

public String getProperty(String name)
From abbot.Resolver.

Specified by:
getProperty in interface Resolver

getContextClassLoader

public ClassLoader getContextClassLoader()
From abbot.Resolver.

Specified by:
getContextClassLoader in interface Resolver

getHierarchy

public Hierarchy getHierarchy()
Description copied from interface: Resolver
Get the component corresponding to the given reference.

Specified by:
getHierarchy in interface Resolver

toString

public String toString()

setDocumentationProperties

public static void setDocumentationProperties(String[] action)
Deprecated. Set the properties for your action directly. Install the given documentation properties, given as an array of four Strings. Add-on classes derived from ComponentTester should invoke this for each exported action. These properties are for use by the editor to better describe the available methods.


showMessage

public static void showMessage(String title,
                               String msg)
Global facility for message dialogs.


showWarning

public static void showWarning(String msg)
Global facility for warning dialog.


showWarning

public static void showWarning(String title,
                               String msg)
Global facility for warning dialog.


showInputDialog

public static String showInputDialog(String title,
                                     String msg,
                                     String initial)
Global facility for obtaining a user input String.


showError

public static void showError(String msg)
Global facility for error dialogs.


showError

public static void showError(String title,
                             String msg)
Global facility for error dialogs.


showConfirmation

public static int showConfirmation(String msg)

showConfirmation

public static int showConfirmation(String msg,
                                   int opts)

dispose

void dispose()

main

public static void main(String[] args)
Launch the script editor, with an argument of either a test suite class or a script filename.



Copyright © 2002-2004 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge