Interface ThreadedPlugIn

All Superinterfaces:
All Known Implementing Classes:
AbstractAddDatastoreLayerPlugIn, AddDatastoreLayerPlugIn, AffineTransformationPlugIn, AttributeQueryPlugIn, BufferPlugIn, ConvexHullPlugIn, DiffGeometryPlugIn, DiffSegmentsPlugIn, ExtractSegmentsPlugIn, GeometryFunctionPlugIn, LineNoderPlugIn, LoadDatasetPlugIn, LoadDatasetPlugIn, LoadDatasetToCategoryPlugIn, MainButtonPlugIn, OpenProjectPlugIn, OverlayPlugIn, PolygonizerPlugIn, PrecisionReducerPlugIn, ProgressReportingPlugIn, RunDatastoreQueryPlugIn, SaveDatasetAsPlugIn, SaveDatasetAsPlugIn, SpatialJoinPlugIn, SpatialQueryPlugIn, ThreadedBasePlugIn, UnionPlugIn, ValidateSelectedLayersPlugIn

public interface ThreadedPlugIn
extends PlugIn

A long-running PlugIn that keeps the GUI responsive (but only partially so, as a modal progress dialog will be in the way).

First, #execute is called on the AWT event dispatch thread (the "GUI thread"). Here, the user can be prompted with a dialog.

Then, #run(TaskMonitor) is called, on a new thread. Here, a long operation can be performed. The TaskMonitor can be used to report progress (messages will appear on a modal progress dialog). Because the thread is not the GUI thread, the GUI will remain responsive.

Thus, to run a PlugIn on a separate thread with progress reporting:

Method Summary
 void run(TaskMonitor monitor, PlugInContext context)
          Runs the task.
Methods inherited from interface com.vividsolutions.jump.workbench.plugin.PlugIn
execute, getName, initialize

Method Detail


void run(TaskMonitor monitor,
         PlugInContext context)
         throws java.lang.Exception
Runs the task. This method will be executed in a separate thread, so that the GUI remains responsive (but only partially so, as a modal progress dialog will be in the way). Don't call GUI classes in this method as it is not executed on the GUI thread.

monitor - context to which this task can report its progress and check whether a party has requested its cancellation