com.vividsolutions.jump.workbench.plugin
Class AbstractPlugIn

java.lang.Object
  extended bycom.vividsolutions.jump.workbench.plugin.AbstractPlugIn
All Implemented Interfaces:
PlugIn
Direct Known Subclasses:
AboutPlugIn, AbstractSaveProjectPlugIn, AddImageLayerPlugIn, AddNewCategoryPlugIn, AddNewLayerPlugIn, AddWMSDemoBoxEasterEggPlugIn, AddWMSQueryPlugIn, AffineTransformPlugIn, AttributeQueryPlugIn, BoundaryMatchDataPlugIn, BufferPlugIn, CalculateAreasAndLengthsPlugIn, ChangeCoordinateSystemPlugIn, ChangeStylesPlugIn, ClearSelectionPlugIn, CloneWindowPlugIn, CombineSelectedFeaturesPlugIn, ConvexHullPlugIn, CopySelectedItemsPlugIn, CopySelectedLayersToWarpingVectorsPlugIn, CopyStylesPlugIn, CopyThisCoordinatePlugIn, CustomFillPatternExamplePlugIn, DeleteAllFeaturesPlugIn, DeleteSelectedItemsPlugIn, EditablePlugIn, EditWMSQueryPlugIn, ExplodeSelectedFeaturesPlugIn, ExportImagePlugIn, FeatureInfoPlugIn, FeatureStatisticsPlugIn, FirstTaskFramePlugIn, GenerateLogPlugIn, GeometryFunctionPlugIn, ImageLayerManagerPlugIn, InstallDatastoreLayerRendererHintsPlugIn, InstallDelineationToolPlugIn, InstallReferencedImageFactoriesPlugin, InstallRendererPlugIn, InstallSkinsPlugIn, InstallStandardDataSourceQueryChoosersPlugIn, InstallStandardFeatureTextWritersPlugIn, InstallZoomBarPlugIn, LayerableClipboardPlugIn, LayerStatisticsPlugIn, LoadDatasetToCategoryPlugIn, MacroPlugIn, MapToolTipsPlugIn, MicroscopePlugIn, MoveLayerablePlugIn, NewTaskPlugIn, OptionsPlugIn, OutputWindowPlugIn, OverlayPlugIn, PasteItemsPlugIn, PasteStylesPlugIn, PersistentBlackboardPlugIn, RandomArrowsPlugIn, RandomTrianglesPlugIn, RedoPlugIn, RefreshDataStoreLayerPlugin, RemoveSelectedCategoriesPlugIn, RemoveSelectedLayersPlugIn, ScaleBarPlugIn, SelectFeaturesInFencePlugIn, ShortcutKeysPlugIn, ShowTriangulationPlugIn, SpatialJoinPlugIn, SpatialQueryPlugIn, TestColorThemingPlugIn, ThreadedBasePlugIn, ToolboxPlugIn, UndoPlugIn, UnionPlugIn, ValidateSelectedLayersPlugIn, VerticesInFencePlugIn, ViewAttributesPlugIn, ViewSchemaPlugIn, WKTPlugIn, ZoomNextPlugIn, ZoomPreviousPlugIn, ZoomToClickPlugIn, ZoomToCoordinatePlugIn, ZoomToFencePlugIn, ZoomToFullExtentPlugIn, ZoomToLayerPlugIn, ZoomToSelectedItemsPlugIn

public abstract class AbstractPlugIn
extends java.lang.Object
implements PlugIn

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.


Constructor Summary
AbstractPlugIn()
           
AbstractPlugIn(java.lang.String name)
           
 
Method Summary
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)
           
 java.lang.String getName()
          Returns a very brief description of this PlugIn e.g.
 void initialize(PlugInContext context)
          Called when Workbench starts up to allow plugins to initialize themselves.
protected  boolean isRollingBackInvalidEdits(PlugInContext context)
           
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.
static java.awt.event.ActionListener toActionListener(PlugIn plugIn, WorkbenchContext workbenchContext, TaskMonitorManager taskMonitorManager)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPlugIn

public AbstractPlugIn()

AbstractPlugIn

public AbstractPlugIn(java.lang.String name)
Method Detail

execute

protected void execute(UndoableCommand command,
                       PlugInContext context)

initialize

public void initialize(PlugInContext context)
                throws java.lang.Exception
Description copied from interface: PlugIn
Called when Workbench starts up to allow plugins to initialize themselves.

Specified by:
initialize in interface PlugIn
Throws:
java.lang.Exception

execute

public boolean execute(PlugInContext context)
                throws java.lang.Exception
Description copied from interface: PlugIn
Performs the action for this plugin. For threaded plugins with dialogs, this method contains the code to invoke the dialog. If the user cancels the dialog, this method should return false to prevent the run method from being called.

Specified by:
execute in interface PlugIn
Returns:
true if the action completed, false if it was aborted. Used by ThreadedPlugIns to indicate that their #run method needn't be called next.
Throws:
java.lang.Exception - if a problem occurs during plug-in execution
See Also:
ThreadedPlugIn

getName

public java.lang.String getName()
Description copied from interface: PlugIn
Returns a very brief description of this PlugIn e.g. for display as a menu item

Specified by:
getName in interface PlugIn
Returns:
the class name, minus "PlugIn", with spaces inserted at the appropraite point before each uppercase+lowercase and lowercase+uppercase combination.

createName

public static java.lang.String createName(java.lang.Class plugInClass)

toActionListener

public static java.awt.event.ActionListener toActionListener(PlugIn plugIn,
                                                             WorkbenchContext workbenchContext,
                                                             TaskMonitorManager taskMonitorManager)
Parameters:
taskMonitorManager - can be null if you do not wish to use the Task Monitor progress-reporting framework

execute

public static void execute(UndoableCommand command,
                           LayerManagerProxy layerManagerProxy)

toString

public java.lang.String toString()

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.


isRollingBackInvalidEdits

protected boolean isRollingBackInvalidEdits(PlugInContext context)