Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gjt.sp.jedit
Class Macros

    java.lang.Object
      org.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:

- `confirm(Component,String,int)`
- `confirm(Component,String,int,int)`
- `error(Component,String)`
- `input(Component,String)`
- `input(Component,String,String)`
- `message(Component,String)`

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

Version:
  $Id: Macros.java,v 1.40 2004/07/12 19:25:07 spestov Exp $
Author:
  Slava Pestov

Nested Class Summary
`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 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)
`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` | `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`

Constructor Detail

### Macros

    public Macros()

Method Detail

### showRunScriptDialog

    public static void showRunScriptDialog(View view)

  Prompts for one or more files to run as macros

  Parameters:
    `view` - The view
  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)` method, this method can run scripts supported by any registered macro handler.

  Parameters:
    `view` - The view
    `path` - The VFS path of the script
    `ignoreUnknown` - 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

    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.

  Parameters:
    `comp` - The component to show the dialog on behalf of, this will usually be a view instance
    `message` - The message
  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.

  Parameters:
    `comp` - The component to show the dialog on behalf of, this will usually be a view instance
    `message` - The message
  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.

  Parameters:
    `comp` - The component to show the dialog on behalf of, this will usually be a view instance
    `prompt` - The prompt string
  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.

  Parameters:
    `comp` - The component to show the dialog on behalf of, this will usually be a view instance
    `prompt` - The prompt string
  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.

  Parameters:
    `comp` - The component to show the dialog on behalf of, this will usually be a view instance
    `prompt` - The prompt string
    `buttons` - The buttons to display - for example, JOptionPane.YES_NO_CANCEL_OPTION
  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.

  Parameters:
    `comp` - The component to show the dialog on behalf of, this will usually be a view instance
    `prompt` - The prompt string
    `buttons` - The buttons to display - for example, JOptionPane.YES_NO_CANCEL_OPTION
    `type` - 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

    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.

  Parameters:
    `macro` - The macro's name
  Since:
    jEdit 2.6pre1

### recordTemporaryMacro

    public static void recordTemporaryMacro(View view)

  Starts recording a temporary macro.

  Parameters:
    `view` - The view
  Since:
    jEdit 2.7pre2

### recordMacro

    public static void recordMacro(View view)

  Starts recording a macro.

  Parameters:
    `view` - The view
  Since:
    jEdit 2.7pre2

### stopRecording

    public static void stopRecording(View view)

  Stops a recording currently in progress.

  Parameters:
    `view` - The view
  Since:
    jEdit 2.7pre2

### runTemporaryMacro

    public static void runTemporaryMacro(View view)

  Runs the temporary macro.

  Parameters:
    `view` - The view
  Since:
    jEdit 2.7pre2

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD