Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit
Class Macros  view Macros download Macros.java

java.lang.Object
  extended byorg.gjt.sp.jedit.Macros

public class Macros
extends java.lang.Object

This class records and runs macros.

It also contains a few methods useful for displaying output messages or obtaining input from a macro:

Note that plugins should not use the above methods. Call the methods in the GUIUtilities class instead.

Version:
$Id: Macros.java,v 1.37 2003/08/20 20:23:53 spestov Exp $

Nested Class Summary
(package private) static class Macros.BeanShellHandler
           
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.
 
Field Summary
private static ActionSet macroActionSet
           
private static java.util.ArrayList macroHandlers
           
private static java.util.Hashtable macroHash
           
private static java.util.Vector macroHierarchy
           
private static java.lang.String systemMacroPath
           
private static java.lang.String userMacroPath
           
 
Constructor Summary
Macros()
           
 
Method Summary
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 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)
private static void loadMacros(java.util.Vector vector, java.lang.String path, java.io.File directory)
           
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.
private static void recordMacro(View view, Buffer buffer, boolean temporary)
          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 showRunScriptDialog(View view)
          Prompts for one or more files to run as macros
static void stopRecording(View view)
          Stops a recording currently in progress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemMacroPath

private static java.lang.String systemMacroPath

userMacroPath

private static java.lang.String userMacroPath

macroHandlers

private static java.util.ArrayList macroHandlers

macroActionSet

private static ActionSet macroActionSet

macroHierarchy

private static java.util.Vector macroHierarchy

macroHash

private static java.util.Hashtable macroHash
Constructor Detail

Macros

public Macros()
Method Detail

showRunScriptDialog

public static void showRunScriptDialog(View view)
Prompts for one or more files to run as macros

Since:
jEdit 4.0pre7

runScript

public static void runScript(View view,
                             java.lang.String path,
                             boolean ignoreUnknown)
Runs the specified script. Unlike the BeanShell.runScript(View,String,Reader,boolean) 55 method, this method can run scripts supported by any registered macro handler.

Since:
jEdit 4.1pre2

message

public 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.

Since:
jEdit 2.7pre2

error

public 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.

Since:
jEdit 2.7pre2

input

public 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.

Since:
jEdit 2.7pre2

input

public 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.

Since:
jEdit 3.1final

confirm

public 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.

Since:
jEdit 4.0pre2

confirm

public 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.


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

public static void registerHandler(Macros.Handler handler)
Adds a macro handler to the handlers list

Since:
jEdit 4.0pre6

getHandlers

public static Macros.Handler[] getHandlers()
Returns an array containing the list of registered macro handlers

Since:
jEdit 4.0pre6

getHandlerForPathName

public 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.

Since:
jEdit 4.1pre3

getHandler

public 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.

Since:
jEdit 4.0pre6

getMacroHierarchy

public static java.util.Vector 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

public static ActionSet getMacroActionSet()
Returns an action set with all known macros in it.

Since:
jEdit 4.0pre1

getMacro

public static Macros.Macro getMacro(java.lang.String macro)
Returns the macro with the specified name.

Since:
jEdit 2.6pre1

recordTemporaryMacro

public static void recordTemporaryMacro(View view)
Starts recording a temporary macro.

Since:
jEdit 2.7pre2

recordMacro

public static void recordMacro(View view)
Starts recording a macro.

Since:
jEdit 2.7pre2

stopRecording

public static void stopRecording(View view)
Stops a recording currently in progress.

Since:
jEdit 2.7pre2

runTemporaryMacro

public static void runTemporaryMacro(View view)
Runs the temporary macro.

Since:
jEdit 2.7pre2

loadMacros

private static void loadMacros(java.util.Vector vector,
                               java.lang.String path,
                               java.io.File directory)

recordMacro

private static void recordMacro(View view,
                                Buffer buffer,
                                boolean temporary)
Starts recording a macro.

Since:
jEdit 3.0pre5