Ignore:
Timestamp:
2016-07-23T14:54:19+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #12478, fix #12565, fix #11114 - Use ​Swing Copy/Paste instead of CopyAction/PasteAction with custom buffer (patch by michael2402, modified) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DuplicateAction.java

    r10409 r10604  
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
    14 import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy;
     14import org.openstreetmap.josm.gui.datatransfer.OsmTransferHandler;
     15import org.openstreetmap.josm.gui.datatransfer.PrimitiveTransferable;
     16import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
    1517import org.openstreetmap.josm.tools.Shortcut;
    1618
     19/**
     20 * An action that dupplicates the given nodes. They are not added to the clipboard.
     21 */
    1722public final class DuplicateAction extends JosmAction {
    1823
     
    2227    public DuplicateAction() {
    2328        super(tr("Duplicate"), "duplicate",
    24                 tr("Duplicate selection by copy and immediate paste."),
     29                tr("Duplicate selection."),
    2530                Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.CTRL), true);
    2631        putValue("help", ht("/Action/Duplicate"));
     
    2934    @Override
    3035    public void actionPerformed(ActionEvent e) {
    31         Main.main.menu.paste.pasteData(
    32                 new PrimitiveDeepCopy(getLayerManager().getEditDataSet().getSelected()), getLayerManager().getEditLayer(), e);
     36        PrimitiveTransferData data = PrimitiveTransferData.getDataWithReferences(getLayerManager().getEditDataSet().getSelected());
     37        new OsmTransferHandler().pasteOn(Main.getLayerManager().getEditLayer(), data.getCenter(), new PrimitiveTransferable(data));
    3338    }
    3439
Note: See TracChangeset for help on using the changeset viewer.