public abstract class AbstractPasteAction extends JosmAction implements java.awt.datatransfer.FlavorListener
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
protected OsmTransferHandler |
transferHandler |
sc
Constructor and Description |
---|
AbstractPasteAction(java.lang.String name,
java.lang.String iconName,
java.lang.String tooltip,
Shortcut shortcut,
boolean registerInToolbar)
Constructs a new
AbstractPasteAction . |
AbstractPasteAction(java.lang.String name,
java.lang.String iconName,
java.lang.String tooltip,
Shortcut shortcut,
boolean registerInToolbar,
java.lang.String toolbarId)
Constructs a new
AbstractPasteAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
protected EastNorth |
computePastePosition(java.awt.event.ActionEvent e)
Compute the location the objects should be pasted at.
|
protected void |
doPaste(java.awt.event.ActionEvent e,
java.awt.datatransfer.Transferable contents) |
void |
flavorsChanged(java.awt.datatransfer.FlavorEvent e) |
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e.
|
checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setTooltip, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
protected final OsmTransferHandler transferHandler
public AbstractPasteAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar)
AbstractPasteAction
.name
- the action's text as displayed on the menu (if it is added to a menu)iconName
- the filename of the icon to usetooltip
- a longer description of the action that will be displayed in the tooltip. Please note
that html is not supported for menu actions on some platforms.shortcut
- a ready-created shortcut object or null if you don't want a shortcut. But you always
do want a shortcut, remember you can always register it with group=none, so you
won't be assigned a shortcut unless the user configures one. If you pass null here,
the user CANNOT configure a shortcut for your action.registerInToolbar
- register this action for the toolbar preferences?public AbstractPasteAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar, java.lang.String toolbarId)
AbstractPasteAction
.name
- the action's text as displayed on the menu (if it is added to a menu)iconName
- the filename of the icon to usetooltip
- a longer description of the action that will be displayed in the tooltip. Please note
that html is not supported for menu actions on some platforms.shortcut
- a ready-created shortcut object or null if you don't want a shortcut. But you always
do want a shortcut, remember you can always register it with group=none, so you
won't be assigned a shortcut unless the user configures one. If you pass null here,
the user CANNOT configure a shortcut for your action.registerInToolbar
- register this action for the toolbar preferences?toolbarId
- identifier for the toolbar preferences. The iconName is used, if this parameter is nullprotected EastNorth computePastePosition(java.awt.event.ActionEvent e)
e
- The action event that triggered the pastepublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
protected void doPaste(java.awt.event.ActionEvent e, java.awt.datatransfer.Transferable contents)
protected void updateEnabledState()
JosmAction
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
,
JosmAction.listenToLayerChange()
public void flavorsChanged(java.awt.datatransfer.FlavorEvent e)
flavorsChanged
in interface java.awt.datatransfer.FlavorListener