public abstract class PluginAction
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PluginAction.Property
Enumeration of the various properties this action may define.
|
Constructor and Description |
---|
PluginAction()
Creates a disabled plug-in action.
|
PluginAction(java.lang.String resourceBaseName,
java.lang.String actionPrefix,
java.lang.ClassLoader pluginClassLoader)
Creates a disabled plug-in action with properties retrieved from a resource bundle
in which key starts with
actionPrefix . |
PluginAction(java.lang.String resourceBaseName,
java.lang.String actionPrefix,
java.lang.ClassLoader pluginClassLoader,
boolean enabled)
Creates an action with properties retrieved from a resource bundle
in which key starts with
actionPrefix . |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the property change
listener in parameter to this plugin action. |
abstract void |
execute()
Executes this action.
|
java.lang.Object |
getPropertyValue(PluginAction.Property property)
Returns a property value of this action.
|
boolean |
isEnabled()
Returns the enabled state of this action.
|
void |
putPropertyValue(PluginAction.Property property,
java.lang.Object value)
Sets a property value of this action, and fires a
PropertyChangeEvent
if the value changed. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the property change
listener in parameter from this plugin action. |
void |
setEnabled(boolean enabled)
Sets the enabled state of this action.
|
public PluginAction()
public PluginAction(java.lang.String resourceBaseName, java.lang.String actionPrefix, java.lang.ClassLoader pluginClassLoader)
actionPrefix
.
new PluginAction("com.mycompany.mypackage.MyResources", "EXPORT", plugin.getPluginClassLoader())
will retrieve its property values from the /com/mycompany/mypackage/MyResources.properties
file
bundled with the plug-in class, and this file may describe the action EXPORT
with the following keys:
EXPORT.NAME=Export EXPORT.SHORT_DESCRIPTION=Export home data EXPORT.SMALL_ICON=/com/mycompany/mypackage/resources/export.png EXPORT.MNEMONIC=X EXPORT.TOOL_BAR=true EXPORT.MENU=File
resourceBaseName
- the base name of a resource bundleactionPrefix
- prefix used in resource bundle to search action propertiespluginClassLoader
- the class loader that will be used to search the resource bundlejava.util.MissingResourceException
- if no resource bundle could be found from
resourceBaseName
.public PluginAction(java.lang.String resourceBaseName, java.lang.String actionPrefix, java.lang.ClassLoader pluginClassLoader, boolean enabled)
actionPrefix
.resourceBaseName
- the base name of a resource bundleactionPrefix
- prefix used in resource bundle to search action propertiespluginClassLoader
- the class loader that will be used to search the resource bundleenabled
- true
if the action should be enabled at creation.java.util.MissingResourceException
- if no resource bundle could be found from
resourceBaseName
.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
in parameter to this plugin action.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
in parameter from this plugin action.public java.lang.Object getPropertyValue(PluginAction.Property property)
public void putPropertyValue(PluginAction.Property property, java.lang.Object value)
PropertyChangeEvent
if the value changed.public void setEnabled(boolean enabled)
execute
method.
If the value has changed, a PropertyChangeEvent
is sent
to listeners. By default, an action is disabled.public boolean isEnabled()
true
if this action is enabled.public abstract void execute()
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License