Package org.openjump.core.ui.plugin
Class AbstractUiPlugIn
- java.lang.Object
-
- com.vividsolutions.jump.workbench.plugin.AbstractPlugIn
-
- org.openjump.core.ui.plugin.AbstractUiPlugIn
-
- All Implemented Interfaces:
EnableChecked,Iconified,PlugIn,Recordable,ShortcutEnabled,ActionListener,EventListener
- Direct Known Subclasses:
AbstractThreadedUiPlugIn,AddImageLayerPlugIn,AutoAssignAttributePlugIn,CreateGridPlugIn,FileDragDropPlugin,GenerateRandomNumberPlugIn,GenerateRandomStringPlugIn,GenerateUniqueRandomIdPlugIn,MosaicInternalFramesPlugIn,OpenRecentPlugIn,SynchronizationPlugIn
public abstract class AbstractUiPlugIn extends AbstractPlugIn implements ActionListener
Default implementation of PlugIn, with useful functions for auto-generating a name, converting a PlugIn into an ActionListener (for use with JButtons, for example), and supporting undo.
-
-
Field Summary
Fields Modifier and Type Field Description protected EnableCheckenableCheckprotected WorkbenchContextworkbenchContextThe workbench context.-
Fields inherited from class com.vividsolutions.jump.workbench.plugin.AbstractPlugIn
shortcutKeys, shortcutModifiers
-
-
Constructor Summary
Constructors Constructor Description AbstractUiPlugIn()AbstractUiPlugIn(String name)AbstractUiPlugIn(String name, String toolTip)AbstractUiPlugIn(String name, Icon icon)AbstractUiPlugIn(String name, Icon icon, String toolTip)AbstractUiPlugIn(Icon icon)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(ActionEvent e)Wrap the plug-in as an ActionListener.booleanexecute(PlugInContext context)Method to be overridden by implementations to execute the plug-in.EnableCheckgetEnableCheck()Use reflection to find an EnableCheck object defined by old method createEnableCheck in this plugin.IcongetIcon()Get the icon for the plug-in.StringgetName()Get the name of the plug-in.StringgetToolTip()Get the tool-tip for the plug-in.voidinitialize(PlugInContext context)Method to be overridden by implementations to initialize the plug-in.protected booleanisRollingBackInvalidEdits(PlugInContext context)protected voidreportNothingToUndoYet(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.protected voidsetWorkbenchContext(WorkbenchContext workbenchContext)-
Methods inherited from class com.vividsolutions.jump.workbench.plugin.AbstractPlugIn
addParameter, createName, execute, execute, getBooleanParam, getContext, getDoubleParam, getIcon, getIcon, getIntegerParam, getParameter, getParameters, getShortcutKeys, getShortcutKeyStroke, getShortcutModifiers, getStringParam, getWorkbenchContext, isShortcutEnabled, setParameters, setShortcutKeys, setShortcutModifiers, toActionListener, toString
-
-
-
-
Field Detail
-
workbenchContext
protected WorkbenchContext workbenchContext
The workbench context.
-
enableCheck
protected EnableCheck enableCheck
-
-
Method Detail
-
initialize
public void initialize(PlugInContext context) throws Exception
Method to be overridden by implementations to initialize the plug-in. Plug-ins must invoke super.initialize().- Specified by:
initializein interfacePlugIn- Overrides:
initializein classAbstractPlugIn- Parameters:
context- The plug-in context.- Throws:
Exception- if an exception occur during initialization
-
execute
public boolean execute(PlugInContext context) throws Exception
Method to be overridden by implementations to execute the plug-in.- Specified by:
executein interfacePlugIn- Overrides:
executein classAbstractPlugIn- Parameters:
context- The plug-in context.- Returns:
- true if the PlugIn has been executed
- Throws:
Exception- if an Exception occurs during execution- See Also:
ThreadedPlugIn
-
reportNothingToUndoYet
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. In either case, the undo history will be preserved. If this method is not called, then this plug-in will be assumed to be non-undoable, and the undo history will be truncated.- Overrides:
reportNothingToUndoYetin classAbstractPlugIn- Parameters:
context- plugin context
-
isRollingBackInvalidEdits
protected boolean isRollingBackInvalidEdits(PlugInContext context)
- Overrides:
isRollingBackInvalidEditsin classAbstractPlugIn
-
actionPerformed
public void actionPerformed(ActionEvent e)
Wrap the plug-in as an ActionListener.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- The action event.
-
getEnableCheck
public EnableCheck getEnableCheck()
Description copied from class:AbstractPlugInUse reflection to find an EnableCheck object defined by old method createEnableCheck in this plugin.- Specified by:
getEnableCheckin interfaceEnableChecked- Overrides:
getEnableCheckin classAbstractPlugIn- Returns:
- the EnableCheck defined the old way
-
getIcon
public Icon getIcon()
Get the icon for the plug-in.- Specified by:
getIconin interfaceIconified- Overrides:
getIconin classAbstractPlugIn- Returns:
- The icon.
-
getName
public String getName()
Get the name of the plug-in. If a name was not specified ask super class.- Specified by:
getNamein interfacePlugIn- Overrides:
getNamein classAbstractPlugIn- Returns:
- The plug-in name.
-
getToolTip
public String getToolTip()
Get the tool-tip for the plug-in.- Returns:
- The tool-tip.
-
setWorkbenchContext
protected void setWorkbenchContext(WorkbenchContext workbenchContext)
- Parameters:
workbenchContext- the workbenchContext to set
-
-