| java.lang.Object org.gjt.sp.jedit.ActionSet
ActionSet | public class ActionSet (Code) | | 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:
actions.xml - actions made available for use in jEdit views,
including the view's Plugins menu, the tool bar, etc.
browser.actions.xml - actions for the file system browser's
Plugins menu.
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:
-
ACTIONS is the top-level element and refers
to the set of actions used by the plugin.
-
An
ACTION contains the data for a particular action.
It has three attributes: a required NAME ;
an optional NO_REPEAT , which is a flag
indicating whether the action should not be repeated with the
C+ENTER command; and an optional
NO_RECORD which is a a flag indicating whether the
action should be recorded if it is invoked while the user is recording a
macro. The two flag attributes
can have two possible values, "TRUE" or
"FALSE". In both cases, "FALSE" is the
default if the attribute is not specified.
-
An
ACTION can have two child elements
within it: a required CODE element which
specifies the
BeanShell code that will be executed when the action is invoked,
and an optional IS_SELECTED element, used for
checkbox
menu items. The IS_SELECTED element contains
BeanShell code that returns a boolean flag that will
determine the state of the checkbox.
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) to add a custom action set to
jEdit's action context. You must also call
ActionSet.initKeyBindings() for new
action sets. Don't forget to call
jEdit.removeActionSet(ActionSet) before your plugin is unloaded, too.
See Also: jEdit.getActionContext See Also: org.gjt.sp.jedit.browser.VFSBrowser.getActionContext See Also: ActionContext.getActionNames See Also: ActionContext.getAction(String) See Also: jEdit.addActionSet(ActionSet) See Also: jEdit.removeActionSet(ActionSet) See Also: PluginJAR.getActionSet See Also: BeanShell See Also: View author: Slava Pestov author: John Gellene (API documentation) version: $Id: ActionSet.java 9529 2007-05-12 15:06:52Z ezust $ since: jEdit 4.0pre1 |
ActionSet | public ActionSet()(Code) | | Creates a new action set.
since: jEdit 4.0pre1 |
ActionSet | public ActionSet(PluginJAR plugin, String[] cachedActionNames, boolean[] cachedActionToggleFlags, URL uri)(Code) | | Creates a new action set.
Parameters: plugin - The plugin Parameters: cachedActionNames - The list of cached action names Parameters: cachedActionToggleFlags - The list of cached action toggle flags Parameters: uri - The actions.xml URI since: jEdit 4.2pre2 |
ActionSet | public ActionSet(String label)(Code) | | Creates a new action set.
Parameters: label - The label, shown in the shortcuts option pane since: jEdit 4.0pre1 |
addAction | public void addAction(EditAction action)(Code) | | Adds an action to the action set.
Parameters: action - The action since: jEdit 4.0pre1 |
contains | public boolean contains(String action)(Code) | | Returns if this action set contains the specified action.
Parameters: action - The action since: jEdit 4.2pre1 |
getAction | public EditAction getAction(String name)(Code) | | Returns an action with the specified name.
Deferred loading: this will load the action set if necessary.
Parameters: name - The action name since: jEdit 4.0pre1 |
getActionCount | public int getActionCount()(Code) | | Returns the number of actions in the set.
since: jEdit 4.0pre1 |
getActionNames | public String[] getActionNames()(Code) | | Returns an array of all action names in this action set.
since: jEdit 4.2pre1 |
getActionNames | void getActionNames(List vec)(Code) | | |
getActions | public EditAction[] getActions()(Code) | | Returns an array of all actions in this action set.
Deferred loading: this will load the action set if necessary.
since: jEdit 4.0pre1 |
getCacheableActionNames | public String[] getCacheableActionNames()(Code) | | Returns an array of all action names in this action set that should
be cached; namely, BeanShellAction s.
since: jEdit 4.2pre1 |
getLabel | public String getLabel()(Code) | | Return the action source label.
since: jEdit 4.0pre1 |
getPluginJAR | public PluginJAR getPluginJAR()(Code) | | Return the plugin this action set was loaded from, or null.
since: jEdit 4.2pre13 |
initKeyBindings | public void initKeyBindings()(Code) | | 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()(Code) | | Forces the action set to be loaded. Plugins and macros should not
call this method.
since: jEdit 4.2pre1 |
removeAction | public void removeAction(String name)(Code) | | Removes an action from the action set.
Parameters: name - The action name since: jEdit 4.0pre1 |
removeAllActions | public void removeAllActions()(Code) | | Removes all actions from the action set.
since: jEdit 4.0pre1 |
setLabel | public void setLabel(String label)(Code) | | Sets the action source label.
Parameters: label - The label since: jEdit 4.0pre1 |
size | public int size()(Code) | | Returns the number of actions in this action set.
since: jEdit 4.2pre2 |
|
|