|
|||||||||
| Home >> All >> org >> gjt >> sp >> [ jedit overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.gjt.sp.jedit
Class ActionSet

java.lang.Objectorg.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: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:
-
ACTIONSis the top-level element and refers to the set of actions used by the plugin. -
An
ACTIONcontains the data for a particular action. It has three attributes: a requiredNAME; an optionalNO_REPEAT, which is a flag indicating whether the action should not be repeated with the C+ENTER command; and an optionalNO_RECORDwhich 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
ACTIONcan have two child elements within it: a requiredCODEelement which specifies the BeanShell code that will be executed when the action is invoked, and an optionalIS_SELECTEDelement, used for checkbox menu items. TheIS_SELECTEDelement 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.
View actions
Actions defined inactions.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 inactions.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
CalljEdit.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)
|
|||||||||
| Home >> All >> org >> gjt >> sp >> [ jedit overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.gjt.sp.jedit.ActionSet