public abstract class AbstractPlugIn extends java.lang.Object implements PlugIn, ShortcutEnabled, EnableChecked, Iconified, Recordable
Modifier and Type | Field and Description |
---|---|
protected int |
shortcutKeys |
protected int |
shortcutModifiers |
Constructor and Description |
---|
AbstractPlugIn() |
AbstractPlugIn(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
addParameter(java.lang.String name,
java.lang.Object value) |
static java.lang.String |
createName(java.lang.Class plugInClass) |
boolean |
execute(PlugInContext context)
Performs the action for this plugin.
|
static void |
execute(UndoableCommand command,
LayerManagerProxy layerManagerProxy) |
protected void |
execute(UndoableCommand command,
PlugInContext context) |
static PlugIn[] |
fetchShortcutEnabledPlugins(PlugIn plugin)
Convenience method to collect all plugins of a probably multi shortcut
enabled plugin.
|
java.lang.Boolean |
getBooleanParam(java.lang.String name) |
java.lang.Double |
getDoubleParam(java.lang.String name) |
EnableCheck |
getEnableCheck() |
static EnableCheck |
getEnableCheck(PlugIn plugin)
Utility method to fetch enable checks from enablechecked plugins.
|
javax.swing.Icon |
getIcon(java.awt.Dimension dim) |
javax.swing.Icon |
getIcon(int height) |
java.lang.Integer |
getIntegerParam(java.lang.String name) |
java.lang.String |
getName()
Returns a very brief description of this PlugIn e.g. for display as a menu item
|
java.lang.Object |
getParameter(java.lang.String name) |
java.util.Map<java.lang.String,java.lang.Object> |
getParameters() |
int |
getShortcutKeys() |
javax.swing.KeyStroke |
getShortcutKeyStroke()
Convenience Method for getShortcutKeys() and getShortcutModifiers()
|
int |
getShortcutModifiers() |
java.lang.String |
getStringParam(java.lang.String name) |
void |
initialize(PlugInContext context)
Called when Workbench starts up to allow plugins to initialize themselves.
|
protected boolean |
isRollingBackInvalidEdits(PlugInContext context) |
boolean |
isShortcutEnabled() |
static boolean |
registerShortcuts(PlugIn plugin)
Utility method to register global shortcuts.
|
protected void |
reportNothingToUndoYet(PlugInContext context)
Indicates that this plug-in either (1) is undoable but hasn't modified the
system yet or (2) does not modify the system.
|
void |
setParameters(java.util.Map<java.lang.String,java.lang.Object> map)
Set parameters with which to execute a plugin.
|
void |
setShortcutKeys(int shortcutKeys) |
void |
setShortcutModifiers(int shortcutModifiers) |
static java.awt.event.ActionListener |
toActionListener(PlugIn plugIn,
WorkbenchContext workbenchContext,
TaskMonitorManager taskMonitorManager) |
java.lang.String |
toString() |
protected int shortcutModifiers
protected int shortcutKeys
public AbstractPlugIn()
public AbstractPlugIn(java.lang.String name)
public void addParameter(java.lang.String name, java.lang.Object value)
public java.lang.Object getParameter(java.lang.String name)
public java.lang.Boolean getBooleanParam(java.lang.String name)
public java.lang.Integer getIntegerParam(java.lang.String name)
public java.lang.Double getDoubleParam(java.lang.String name)
public java.lang.String getStringParam(java.lang.String name)
public void setParameters(java.util.Map<java.lang.String,java.lang.Object> map)
Recordable
setParameters
in interface Recordable
map
- a map of parameterspublic java.util.Map<java.lang.String,java.lang.Object> getParameters()
protected void execute(UndoableCommand command, PlugInContext context)
public void initialize(PlugInContext context) throws java.lang.Exception
PlugIn
initialize
in interface PlugIn
java.lang.Exception
public boolean execute(PlugInContext context) throws java.lang.Exception
PlugIn
false
to prevent the run method
from being called.execute
in interface PlugIn
java.lang.Exception
- if a problem occurs during plug-in executionThreadedPlugIn
protected void reportNothingToUndoYet(PlugInContext context)
protected boolean isRollingBackInvalidEdits(PlugInContext context)
public boolean isShortcutEnabled()
isShortcutEnabled
in interface ShortcutEnabled
public final int getShortcutModifiers()
getShortcutModifiers
in interface ShortcutEnabled
public void setShortcutModifiers(int shortcutModifiers)
setShortcutModifiers
in interface ShortcutEnabled
public final int getShortcutKeys()
getShortcutKeys
in interface ShortcutEnabled
public void setShortcutKeys(int shortcutKeys)
setShortcutKeys
in interface ShortcutEnabled
public javax.swing.KeyStroke getShortcutKeyStroke()
ShortcutEnabled
getShortcutKeyStroke
in interface ShortcutEnabled
public EnableCheck getEnableCheck()
getEnableCheck
in interface EnableChecked
public javax.swing.Icon getIcon(java.awt.Dimension dim)
public java.lang.String getName()
PlugIn
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String createName(java.lang.Class plugInClass)
public static java.awt.event.ActionListener toActionListener(PlugIn plugIn, WorkbenchContext workbenchContext, TaskMonitorManager taskMonitorManager)
taskMonitorManager
- can be null if you do not wish to use the Task Monitor
progress-reporting frameworkpublic static void execute(UndoableCommand command, LayerManagerProxy layerManagerProxy)
public static EnableCheck getEnableCheck(PlugIn plugin)
plugin
- public static PlugIn[] fetchShortcutEnabledPlugins(PlugIn plugin)
plugin
- public static boolean registerShortcuts(PlugIn plugin)
plugin
-