public class Macros
extends java.lang.Object
It also contains a few methods useful for displaying output messages or obtaining input from a macro:
confirm(Component,String,int)
confirm(Component,String,int,int)
error(Component,String)
input(Component,String)
input(Component,String,String)
message(Component,String)
GUIUtilities
class instead.Modifier and Type | Class and Description |
---|---|
static class |
Macros.Handler
Encapsulates creating and invoking macros in arbitrary scripting languages
|
static class |
Macros.Macro
Encapsulates the macro's label, name and path.
|
static class |
Macros.Recorder
Handles macro recording.
|
Constructor and Description |
---|
Macros() |
Modifier and Type | Method and Description |
---|---|
static int |
confirm(java.awt.Component comp,
java.lang.String prompt,
int buttons)
Utility method that can be used to ask for confirmation in a macro.
|
static int |
confirm(java.awt.Component comp,
java.lang.String prompt,
int buttons,
int type)
Utility method that can be used to ask for confirmation in a macro.
|
static void |
error(java.awt.Component comp,
java.lang.String message)
Utility method that can be used to display an error dialog in a macro.
|
static Macros.Handler |
getHandler(java.lang.String name)
Returns the macro handler with the specified name, or null if
there is no registered handler with that name.
|
static Macros.Handler |
getHandlerForPathName(java.lang.String pathName)
Returns the macro handler suitable for running the specified file
name, or null if there is no suitable handler.
|
static Macros.Handler[] |
getHandlers()
Returns an array containing the list of registered macro handlers
|
static Macros.Macro |
getLastMacro() |
static Macros.Macro |
getMacro(java.lang.String macro)
Returns the macro with the specified name.
|
static ActionSet |
getMacroActionSet()
Returns an action set with all known macros in it.
|
static java.util.Vector |
getMacroHierarchy()
Returns a vector hierarchy with all known macros in it.
|
static java.lang.String |
input(java.awt.Component comp,
java.lang.String prompt)
Utility method that can be used to prompt for input in a macro.
|
static java.lang.String |
input(java.awt.Component comp,
java.lang.String prompt,
java.lang.String defaultValue)
Utility method that can be used to prompt for input in a macro.
|
static void |
loadMacros()
Rebuilds the macros list, and sends a MacrosChanged message
(views update their Macros menu upon receiving it)
|
static void |
message(java.awt.Component comp,
java.lang.String message)
Utility method that can be used to display a message dialog in a macro.
|
static void |
recordMacro(View view)
Starts recording a macro.
|
static void |
recordTemporaryMacro(View view)
Starts recording a temporary macro.
|
static void |
registerHandler(Macros.Handler handler)
Adds a macro handler to the handlers list
|
static void |
runScript(View view,
java.lang.String path,
boolean ignoreUnknown)
Runs the specified script.
|
static void |
runTemporaryMacro(View view)
Runs the temporary macro.
|
static void |
setLastMacro(Macros.Macro macro) |
static void |
showRunScriptDialog(View view)
Prompts for one or more files to run as macros
|
static void |
stopRecording(View view)
Stops a recording currently in progress.
|
static void |
unregisterHandler(Macros.Handler handler)
Removes a macro handler from the handlers list
|
public static void showRunScriptDialog(View view)
view
- The viewpublic static void runScript(View view, java.lang.String path, boolean ignoreUnknown)
BeanShell.runScript(View,String,Reader,boolean)
method, this method can run scripts supported
by any registered macro handler.view
- The viewpath
- The VFS path of the scriptignoreUnknown
- If true, then unknown file types will be
ignored; otherwise, a warning message will be printed and they will
be evaluated as BeanShell scripts.public static void message(java.awt.Component comp, java.lang.String message)
comp
- The component to show the dialog on behalf of, this
will usually be a view instancemessage
- The messagepublic static void error(java.awt.Component comp, java.lang.String message)
comp
- The component to show the dialog on behalf of, this
will usually be a view instancemessage
- The messagepublic static java.lang.String input(java.awt.Component comp, java.lang.String prompt)
comp
- The component to show the dialog on behalf of, this
will usually be a view instanceprompt
- The prompt stringpublic static java.lang.String input(java.awt.Component comp, java.lang.String prompt, java.lang.String defaultValue)
comp
- The component to show the dialog on behalf of, this
will usually be a view instanceprompt
- The prompt stringpublic static int confirm(java.awt.Component comp, java.lang.String prompt, int buttons)
comp
- The component to show the dialog on behalf of, this
will usually be a view instanceprompt
- The prompt stringbuttons
- The buttons to display - for example,
JOptionPane.YES_NO_CANCEL_OPTIONpublic static int confirm(java.awt.Component comp, java.lang.String prompt, int buttons, int type)
comp
- The component to show the dialog on behalf of, this
will usually be a view instanceprompt
- The prompt stringbuttons
- The buttons to display - for example,
JOptionPane.YES_NO_CANCEL_OPTIONtype
- The dialog type - for example,
JOptionPane.WARNING_MESSAGEpublic static void loadMacros()
public static void registerHandler(Macros.Handler handler)
public static void unregisterHandler(Macros.Handler handler)
public static Macros.Handler[] getHandlers()
public static Macros.Handler getHandlerForPathName(java.lang.String pathName)
public static Macros.Handler getHandler(java.lang.String name)
public static java.util.Vector getMacroHierarchy()
public static ActionSet getMacroActionSet()
public static Macros.Macro getMacro(java.lang.String macro)
macro
- The macro's namepublic static Macros.Macro getLastMacro()
public static void setLastMacro(Macros.Macro macro)
public static void recordTemporaryMacro(View view)
view
- The viewpublic static void recordMacro(View view)
view
- The viewpublic static void stopRecording(View view)
view
- The viewpublic static void runTemporaryMacro(View view)
view
- The view