public class ActionSet extends JEditActionSet<EditAction> implements java.lang.Comparable
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.<?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.
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.
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.
name.label
containing
the action's menu item label.
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
.
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
VFSBrowser
instance.
File system browser actions should not define
<IS_SELECTED>
blocks.
jEdit.addActionSet(ActionSet)
to add a custom action set to
jEdit's action context. You must also call JEditActionSet.initKeyBindings()
for new
action sets. Don't forget to call jEdit.removeActionSet(ActionSet)
before your plugin is unloaded, too.actions, loaded, placeholder, uri
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(EditAction action)
Adds an action to the action set.
|
int |
compareTo(java.lang.Object o) |
protected EditAction |
createBeanShellAction(java.lang.String actionName,
java.lang.String code,
java.lang.String selected,
boolean noRepeat,
boolean noRecord,
boolean noRememberLast)
Creates a BeanShellAction.
|
EditAction[] |
getActions()
Returns an array of all actions in this action set.
|
protected EditAction[] |
getArray(int size)
Returns an empty array E[].
|
java.lang.String[] |
getCacheableActionNames()
Returns an array of all action names in this action set that should
be cached; namely,
BeanShellAction s. |
AbstractInputHandler |
getInputHandler() |
java.lang.String |
getLabel() |
PluginJAR |
getPluginJAR() |
protected java.lang.String |
getProperty(java.lang.String name)
Returns a property for the given name.
|
void |
setLabel(java.lang.String label)
Sets the action source label.
|
java.lang.String |
toString() |
contains, getAction, getActionCount, getActionNames, initKeyBindings, load, removeAction, removeAllActions, size
public ActionSet()
public ActionSet(PluginJAR plugin, java.lang.String[] cachedActionNames, boolean[] cachedActionToggleFlags, java.net.URL uri)
plugin
- The plugincachedActionNames
- The list of cached action namescachedActionToggleFlags
- The list of cached action toggle flagsuri
- The actions.xml URIpublic ActionSet(java.lang.String label)
label
- The label, shown in the shortcuts option panepublic void addAction(EditAction action)
addAction
in class JEditActionSet<EditAction>
action
- The actionprotected EditAction[] getArray(int size)
JEditActionSet
getArray
in class JEditActionSet<EditAction>
size
- the size of the arraypublic EditAction[] getActions()
Deferred loading: this will load the action set if necessary.
getActions
in class JEditActionSet<EditAction>
Deferred loading: this will load the action set if necessary.
public java.lang.String getLabel()
public void setLabel(java.lang.String label)
label
- The labelpublic PluginJAR getPluginJAR()
public java.lang.String[] getCacheableActionNames()
BeanShellAction
s.getCacheableActionNames
in class JEditActionSet<EditAction>
BeanShellAction
s.protected java.lang.String getProperty(java.lang.String name)
JEditActionSet
getProperty
in class JEditActionSet<EditAction>
name
- the property namepublic AbstractInputHandler getInputHandler()
getInputHandler
in interface InputHandlerProvider
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public java.lang.String toString()
toString
in class java.lang.Object
protected EditAction createBeanShellAction(java.lang.String actionName, java.lang.String code, java.lang.String selected, boolean noRepeat, boolean noRecord, boolean noRememberLast)
createBeanShellAction
in class JEditActionSet<EditAction>
actionName
- the action namecode
- the codeselected
- selectednoRepeat
- noRepeatnoRecord
- noRecordnoRememberLast
- noRememberLast