|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gjt.sp.jedit.JEditActionSet<E>
public abstract class JEditActionSet<E extends JEditAbstractEditAction>
A set of actions, either loaded from an XML file, or constructed at runtime by a plugin.
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 initKeyBindings()
for new
action sets. Don't forget to call jEdit.removeActionSet(ActionSet)
before your plugin is unloaded, too.
jEdit.getActionContext()
,
VFSBrowser.getActionContext()
,
JEditActionContext.getActionNames()
,
ActionContext.getAction(String)
,
jEdit.addActionSet(ActionSet)
,
jEdit.removeActionSet(ActionSet)
,
PluginJAR.getActionSet()
,
BeanShell
,
View
Field Summary | |
---|---|
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
actions
|
protected boolean |
loaded
|
protected static java.lang.Object |
placeholder
|
protected java.net.URL |
uri
|
Constructor Summary | |
---|---|
JEditActionSet()
Creates a new action set. |
|
JEditActionSet(java.lang.String[] cachedActionNames,
java.net.URL uri)
Creates a new action set. |
Method Summary | |
---|---|
void |
addAction(E action)
Adds an action to the action set. |
boolean |
contains(java.lang.String action)
Returns if this action set contains the specified action. |
protected abstract JEditAbstractEditAction |
createBeanShellAction(java.lang.String actionName,
java.lang.String code,
java.lang.String selected,
boolean noRepeat,
boolean noRecord,
boolean noRememberLast)
This method should be implemented to return an action that will execute the given code |
E |
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. |
E[] |
getActions()
Returns an array of all actions in this action set. |
protected abstract E[] |
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. |
protected abstract java.lang.String |
getProperty(java.lang.String name)
Returns a property for the given name. |
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. |
int |
size()
Returns the number of actions in this action set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.gjt.sp.jedit.input.InputHandlerProvider |
---|
getInputHandler |
Field Detail |
---|
protected java.util.Hashtable<java.lang.String,java.lang.Object> actions
protected java.net.URL uri
protected boolean loaded
protected static final java.lang.Object placeholder
Constructor Detail |
---|
public JEditActionSet()
public JEditActionSet(java.lang.String[] cachedActionNames, java.net.URL uri)
cachedActionNames
- The list of cached action namesuri
- The actions.xml URIMethod Detail |
---|
public void addAction(E action)
action
- The actionpublic void removeAction(java.lang.String name)
name
- The action namepublic void removeAllActions()
public E getAction(java.lang.String name)
Deferred loading: this will load the action set if necessary.
name
- The action namepublic int getActionCount()
public java.lang.String[] getActionNames()
public java.lang.String[] getCacheableActionNames()
BeanShellAction
s.
protected abstract E[] getArray(int size)
size
- the size of the array
public E[] getActions()
Deferred loading: this will load the action set if necessary.
public boolean contains(java.lang.String action)
action
- The actionpublic int size()
public void load()
protected abstract JEditAbstractEditAction createBeanShellAction(java.lang.String actionName, java.lang.String code, java.lang.String selected, boolean noRepeat, boolean noRecord, boolean noRememberLast)
public void initKeyBindings()
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.
protected abstract java.lang.String getProperty(java.lang.String name)
name
- the property name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |