java.lang.Object
org.gjt.sp.jedit.Macros
This class records and runs macros.
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.- Version:
- $Id: Macros.java 25328 2020-05-09 10:17:16Z kpouer $
- Author:
- Slava Pestov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEncapsulates creating and invoking macros in arbitrary scripting languagesstatic classEncapsulates the macro's label, name and path.static classHandles macro recording. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intUtility method that can be used to ask for confirmation in a macro.static intUtility method that can be used to ask for confirmation in a macro.static voidUtility method that can be used to display an error dialog in a macro.static Macros.HandlergetHandler(String name) Returns the macro handler with the specified name, or null if there is no registered handler with that name.static Macros.HandlergetHandlerForPathName(String pathName) Returns the macro handler suitable for running the specified file name, or null if there is no suitable handler.static Macros.Handler[]Returns an array containing the list of registered macro handlersstatic Macros.Macrostatic Macros.MacroReturns the macro with the specified name.static ActionSetReturns an action set with all known macros in it.static VectorReturns a vector hierarchy with all known macros in it.static StringUtility method that can be used to prompt for input in a macro.static StringUtility method that can be used to prompt for input in a macro.static voidRebuilds the macros list, and sends a MacrosChanged message (views update their Macros menu upon receiving it)static voidUtility method that can be used to display a message dialog in a macro.static voidrecordMacro(View view) Starts recording a macro.static voidrecordTemporaryMacro(View view) Starts recording a temporary macro.static voidregisterHandler(Macros.Handler handler) Adds a macro handler to the handlers liststatic voidRuns the specified script.static voidrunTemporaryMacro(View view) Runs the temporary macro.static voidsetLastMacro(Macros.Macro macro) static voidshowRunScriptDialog(View view) Prompts for one or more files to run as macrosstatic voidstopRecording(View view) Stops a recording currently in progress.static voidunregisterHandler(Macros.Handler handler) Removes a macro handler from the handlers list
-
Constructor Details
-
Macros
public Macros()
-
-
Method Details
-
showRunScriptDialog
Prompts for one or more files to run as macros- Parameters:
view- The view- Since:
- jEdit 4.0pre7
-
runScript
Runs the specified script. Unlike theBeanShell.runScript(View,String,Reader,boolean)method, this method can run scripts supported by any registered macro handler.- Parameters:
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.- Since:
- jEdit 4.1pre2
-
message
Utility method that can be used to display a message dialog in a macro.- Parameters:
comp- The component to show the dialog on behalf of, this will usually be a view instancemessage- The message- Since:
- jEdit 2.7pre2
-
error
Utility method that can be used to display an error dialog in a macro.- Parameters:
comp- The component to show the dialog on behalf of, this will usually be a view instancemessage- The message- Since:
- jEdit 2.7pre2
-
input
Utility method that can be used to prompt for input in a macro.- Parameters:
comp- The component to show the dialog on behalf of, this will usually be a view instanceprompt- The prompt string- Since:
- jEdit 2.7pre2
-
input
Utility method that can be used to prompt for input in a macro.- Parameters:
comp- The component to show the dialog on behalf of, this will usually be a view instanceprompt- The prompt string- Since:
- jEdit 3.1final
-
confirm
Utility method that can be used to ask for confirmation in a macro.- Parameters:
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_OPTION- Since:
- jEdit 4.0pre2
-
confirm
Utility method that can be used to ask for confirmation in a macro.- Parameters:
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_MESSAGE
-
loadMacros
public static void loadMacros()Rebuilds the macros list, and sends a MacrosChanged message (views update their Macros menu upon receiving it)- Since:
- jEdit 2.2pre4
-
registerHandler
Adds a macro handler to the handlers list- Since:
- jEdit 4.0pre6
-
unregisterHandler
Removes a macro handler from the handlers list- Since:
- jEdit 4.4.1
-
getHandlers
Returns an array containing the list of registered macro handlers- Since:
- jEdit 4.0pre6
-
getHandlerForPathName
Returns the macro handler suitable for running the specified file name, or null if there is no suitable handler.- Since:
- jEdit 4.1pre3
-
getHandler
Returns the macro handler with the specified name, or null if there is no registered handler with that name.- Since:
- jEdit 4.0pre6
-
getMacroHierarchy
Returns a vector hierarchy with all known macros in it. Each element of this vector is either a macro name string, or another vector. If it is a vector, the first element is a string label, the rest are again, either macro name strings or vectors.- Since:
- jEdit 2.6pre1
-
getMacroActionSet
Returns an action set with all known macros in it.- Since:
- jEdit 4.0pre1
-
getMacro
Returns the macro with the specified name.- Parameters:
macro- The macro's name- Since:
- jEdit 2.6pre1
-
getLastMacro
- Since:
- jEdit 4.3pre1
-
setLastMacro
- Since:
- jEdit 4.3pre1
-
recordTemporaryMacro
Starts recording a temporary macro.- Parameters:
view- The view- Since:
- jEdit 2.7pre2
-
recordMacro
Starts recording a macro.- Parameters:
view- The view- Since:
- jEdit 2.7pre2
-
stopRecording
Stops a recording currently in progress.- Parameters:
view- The view- Since:
- jEdit 2.7pre2
-
runTemporaryMacro
Runs the temporary macro.- Parameters:
view- The view- Since:
- jEdit 2.7pre2
-