Package org.openstreetmap.josm.actions
Class AbstractPasteAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.AbstractPasteAction
-
- All Implemented Interfaces:
java.awt.datatransfer.FlavorListener,java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.Action,Destroyable
- Direct Known Subclasses:
DuplicateAction,PasteAction,PasteAtSourcePositionAction
public abstract class AbstractPasteAction extends JosmAction implements java.awt.datatransfer.FlavorListener
This is the base class for all actions that paste objects.- Since:
- 10765
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
Fields Modifier and Type Field Description protected OsmTransferHandlertransferHandler-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPasteAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar)Constructs a newAbstractPasteAction.protectedAbstractPasteAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar, java.lang.String toolbarId)Constructs a newAbstractPasteAction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)protected EastNorthcomputePastePosition(java.awt.event.ActionEvent e)Compute the location the objects should be pasted at.protected voiddoPaste(java.awt.event.ActionEvent e, java.awt.datatransfer.Transferable contents)voidflavorsChanged(java.awt.datatransfer.FlavorEvent e)protected voidupdateEnabledState()Override in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
transferHandler
protected final OsmTransferHandler transferHandler
-
-
Constructor Detail
-
AbstractPasteAction
protected AbstractPasteAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar)
Constructs a newAbstractPasteAction.- Parameters:
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?
-
AbstractPasteAction
protected AbstractPasteAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar, java.lang.String toolbarId)
Constructs a newAbstractPasteAction.- Parameters:
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 null
-
-
Method Detail
-
computePastePosition
protected EastNorth computePastePosition(java.awt.event.ActionEvent e)
Compute the location the objects should be pasted at.- Parameters:
e- The action event that triggered the paste- Returns:
- The paste position.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
doPaste
protected void doPaste(java.awt.event.ActionEvent e, java.awt.datatransfer.Transferable contents)
-
updateEnabledState
protected void updateEnabledState()
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e. when a layer is removed or added. SeeJosmAction.updateEnabledState(Collection)to respond to changes in the collection of selected primitives. Default behavior is empty.- Overrides:
updateEnabledStatein classJosmAction- See Also:
JosmAction.updateEnabledState(Collection),JosmAction.initEnabledState(),JosmAction.listenToLayerChange()
-
flavorsChanged
public void flavorsChanged(java.awt.datatransfer.FlavorEvent e)
- Specified by:
flavorsChangedin interfacejava.awt.datatransfer.FlavorListener
-
-