001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.actions;
003
004import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
005import static org.openstreetmap.josm.tools.I18n.tr;
006
007import java.awt.event.ActionEvent;
008import java.awt.event.KeyEvent;
009
010import org.openstreetmap.josm.data.coor.EastNorth;
011import org.openstreetmap.josm.tools.Shortcut;
012
013/**
014 * A special version of the {@link PasteAction} that pastes at the exact source location the item was copied from.
015 * @author Michael Zangl
016 * @since 10765
017 */
018public class PasteAtSourcePositionAction extends AbstractPasteAction {
019
020    /**
021     * Constructs a new {@link PasteAtSourcePositionAction}.
022     */
023    public PasteAtSourcePositionAction() {
024        super(tr("Paste at source position"), "paste", tr("Paste contents of clipboard at the position they were copied from."),
025                Shortcut.registerShortcut("menu:edit:pasteAtSource", tr("Edit: {0}", tr("Paste at source position")),
026                        KeyEvent.VK_V, Shortcut.ALT_CTRL), true, "pasteatsource");
027        setHelpId(ht("/Action/Paste"));
028    }
029
030    @Override
031    protected EastNorth computePastePosition(ActionEvent e) {
032        // null means use old position
033        return null;
034    }
035}