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

Quick Search    Search Deep

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

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

public class ActionSet
extends java.lang.Object

A set of actions, either loaded from an XML file, or constructed at runtime by a plugin.

Action sets loaded from XML files

Action sets are read from these files inside the plugin JAR: An action definition file has the following form:
<?xml version="1.0"?>
<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
<ACTIONS>
    <ACTION NAME="some-action">
        <CODE>
            // BeanShell code evaluated when the action is invoked
        </CODE>
    </ACTION>
    <ACTION NAME="some-toggle-action">
        <CODE>
            // BeanShell code evaluated when the action is invoked
        </CODE>
        <IS_SELECTED>
            // BeanShell code that should evaluate to true or false
        </IS_SELECTED>
    </ACTION>
</ACTIONS>
The following elements are valid: Each action must have a property name.label containing the action's menu item label.

View actions

Actions defined in actions.xml can be added to the view's Plugins menu; see EditPlugin. The action code may use any standard predefined BeanShell variable; see BeanShell.

File system browser actions

Actions defined in actions.xml can be added to the file system browser's Plugins menu; see EditPlugin. The action code may use any standard predefined BeanShell variable, in addition to a variable browser which contains a reference to the current org.gjt.sp.jedit.browser.VFSBrowser instance.

File system browser actions should not define <IS_SELECTED> blocks.

Custom action sets

Call jEdit.addActionSet(ActionSet) 55 to add a custom action set to jEdit's action context. You must also call initKeyBindings() 55 for new action sets. Don't forget to call jEdit.removeActionSet(ActionSet) 55 before your plugin is unloaded, too.

Since:
jEdit 4.0pre1
Version:
$Id: ActionSet.java,v 1.25 2003/11/16 00:04:07 spestov Exp $

Field Summary
private  java.util.Hashtable actions
           
(package private)  ActionContext context
           
private  java.lang.String label
           
private  boolean loaded
           
private static java.lang.Object placeholder
           
private  PluginJAR plugin
           
private  java.net.URL uri
           
 
Constructor Summary
ActionSet()
          Creates a new action set.
ActionSet(PluginJAR plugin, java.lang.String[] cachedActionNames, boolean[] cachedActionToggleFlags, java.net.URL uri)
          Creates a new action set.
ActionSet(java.lang.String label)
          Creates a new action set.
 
Method Summary
 void addAction(EditAction action)
          Adds an action to the action set.
 boolean contains(java.lang.String action)
          Returns if this action set contains the specified action.
 EditAction getAction(java.lang.String name)
          Returns an action with the specified name.
 int getActionCount()
          Returns the number of actions in the set.
 java.lang.String[] getActionNames()
          Returns an array of all action names in this action set.
(package private)  void getActionNames(java.util.ArrayList vec)
           
 EditAction[] getActions()
          Returns an array of all actions in this action set.
 java.lang.String[] getCacheableActionNames()
          Returns an array of all action names in this action set that should be cached; namely, BeanShellActions.
 java.lang.String getLabel()
          Return the action source label.
 void initKeyBindings()
          Initializes the action set's key bindings.
 void load()
          Forces the action set to be loaded.
 void removeAction(java.lang.String name)
          Removes an action from the action set.
 void removeAllActions()
          Removes all actions from the action set.
 void setLabel(java.lang.String label)
          Sets the action source label.
 int size()
          Returns the number of actions in this action set.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

context

ActionContext context

label

private java.lang.String label

actions

private java.util.Hashtable actions

plugin

private PluginJAR plugin

uri

private java.net.URL uri

loaded

private boolean loaded

placeholder

private static final java.lang.Object placeholder
Constructor Detail

ActionSet

public ActionSet(PluginJAR plugin,
                 java.lang.String[] cachedActionNames,
                 boolean[] cachedActionToggleFlags,
                 java.net.URL uri)
Creates a new action set.

Since:
jEdit 4.2pre2

ActionSet

public ActionSet()
Creates a new action set.

Since:
jEdit 4.0pre1

ActionSet

public ActionSet(java.lang.String label)
Creates a new action set.

Since:
jEdit 4.0pre1
Method Detail

getLabel

public java.lang.String getLabel()
Return the action source label.

Since:
jEdit 4.0pre1

setLabel

public void setLabel(java.lang.String label)
Sets the action source label.

Since:
jEdit 4.0pre1

addAction

public void addAction(EditAction action)
Adds an action to the action set.

Since:
jEdit 4.0pre1

removeAction

public void removeAction(java.lang.String name)
Removes an action from the action set.

Since:
jEdit 4.0pre1

removeAllActions

public void removeAllActions()
Removes all actions from the action set.

Since:
jEdit 4.0pre1

getAction

public EditAction getAction(java.lang.String name)
Returns an action with the specified name.

Deferred loading: this will load the action set if necessary.

Since:
jEdit 4.0pre1

getActionCount

public int getActionCount()
Returns the number of actions in the set.

Since:
jEdit 4.0pre1

getActionNames

public java.lang.String[] getActionNames()
Returns an array of all action names in this action set.

Since:
jEdit 4.2pre1

getCacheableActionNames

public java.lang.String[] getCacheableActionNames()
Returns an array of all action names in this action set that should be cached; namely, BeanShellActions.

Since:
jEdit 4.2pre1

getActions

public EditAction[] getActions()
Returns an array of all actions in this action set.

Deferred loading: this will load the action set if necessary.

Since:
jEdit 4.0pre1

contains

public boolean contains(java.lang.String action)
Returns if this action set contains the specified action.

Since:
jEdit 4.2pre1

size

public int size()
Returns the number of actions in this action set.

Since:
jEdit 4.2pre2

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


initKeyBindings

public void initKeyBindings()
Initializes the action set's key bindings. jEdit calls this method for all registered action sets when the user changes key bindings in the Global Options dialog box.

Note if your plugin adds a custom action set to jEdit's collection, it must also call this method on the action set after adding it.

Since:
jEdit 4.2pre1

load

public void load()
Forces the action set to be loaded. Plugins and macros should not call this method.

Since:
jEdit 4.2pre1

getActionNames

void getActionNames(java.util.ArrayList vec)