source: josm/trunk/src/org/openstreetmap/josm/actions/DuplicateAction.java@ 10619

Last change on this file since 10619 was 10606, checked in by Don-vip, 8 years ago

javadoc - fix typos

  • Property svn:eol-style set to native
File size: 1.8 KB
RevLine 
[6380]1// License: GPL. For details, see LICENSE file.
[626]2// Author: David Earl
3package org.openstreetmap.josm.actions;
4
[9059]5import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
[626]6import static org.openstreetmap.josm.tools.I18n.tr;
7
8import java.awt.event.ActionEvent;
9import java.awt.event.KeyEvent;
[2256]10import java.util.Collection;
[9059]11
[3969]12import org.openstreetmap.josm.Main;
[2256]13import org.openstreetmap.josm.data.osm.OsmPrimitive;
[10604]14import org.openstreetmap.josm.gui.datatransfer.OsmTransferHandler;
15import org.openstreetmap.josm.gui.datatransfer.PrimitiveTransferable;
16import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
[1084]17import org.openstreetmap.josm.tools.Shortcut;
[626]18
[10604]19/**
[10606]20 * An action that duplicates the given nodes. They are not added to the clipboard.
[10604]21 */
[9059]22public final class DuplicateAction extends JosmAction {
[626]23
[9059]24 /**
25 * Constructs a new {@code DuplicateAction}.
26 */
[626]27 public DuplicateAction() {
[1169]28 super(tr("Duplicate"), "duplicate",
[10604]29 tr("Duplicate selection."),
[4982]30 Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.CTRL), true);
[2323]31 putValue("help", ht("/Action/Duplicate"));
[626]32 }
33
[6084]34 @Override
[1169]35 public void actionPerformed(ActionEvent e) {
[10604]36 PrimitiveTransferData data = PrimitiveTransferData.getDataWithReferences(getLayerManager().getEditDataSet().getSelected());
37 new OsmTransferHandler().pasteOn(Main.getLayerManager().getEditLayer(), data.getCenter(), new PrimitiveTransferable(data));
[626]38 }
[1023]39
[1820]40 @Override
41 protected void updateEnabledState() {
[10409]42 updateEnabledStateOnCurrentSelection();
[1814]43 }
[2256]44
45 @Override
46 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
47 setEnabled(selection != null && !selection.isEmpty());
48 }
[626]49}
Note: See TracBrowser for help on using the repository browser.