Beanshell:Chain Copy/Paste/Move using PlugIns and CursorTool
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Here is how you can use existing PlugIns or CursorTools to chain actions in a simple script
// Import packages (you can also call classes directly using their full name) import com.vividsolutions.jump.workbench.ui.plugin.clipboard.*; import com.vividsolutions.jump.workbench.ui.cursortool.editing.*; // Get PlugIn context from WorkbenchContext context = wc.createPlugInContext(); // Execute CopySelectedItemsPlugIn new CopySelectedItemsPlugIn().execute(context); // Notify the system that you're starting an undoable action // (needed by the PasteItemsPlugIn) wc.layerManager.undoableEditReceiver.startReceiving(); // Execute PasteItemsPlugIn new PasteItemsPlugIn().execute(context); // Set a new MoveSelectedItemsTool as the current CursorTool // of the layerViewPanel wc.layerViewPanel.setCurrentCursorTool(new MoveSelectedItemsTool(context.checkFactory));