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

Last change on this file since 6448 was 6380, checked in by Don-vip, 10 years ago

update license/copyright information

  • Property svn:eol-style set to native
File size: 1.5 KB
RevLine 
[6380]1// License: GPL. For details, see LICENSE file.
[626]2// Author: David Earl
3package org.openstreetmap.josm.actions;
4
5import static org.openstreetmap.josm.tools.I18n.tr;
[2323]6import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
[626]7
8import java.awt.event.ActionEvent;
9import java.awt.event.KeyEvent;
[2256]10import java.util.Collection;
[3969]11import org.openstreetmap.josm.Main;
[626]12
[2256]13import org.openstreetmap.josm.data.osm.OsmPrimitive;
[2305]14import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy;
[1084]15import org.openstreetmap.josm.tools.Shortcut;
[626]16
[1820]17public final class DuplicateAction extends JosmAction{
[626]18
19 public DuplicateAction() {
[1169]20 super(tr("Duplicate"), "duplicate",
[1814]21 tr("Duplicate selection by copy and immediate paste."),
[4982]22 Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.CTRL), true);
[2323]23 putValue("help", ht("/Action/Duplicate"));
[626]24 }
25
[6084]26 @Override
[1169]27 public void actionPerformed(ActionEvent e) {
[3969]28 Main.main.menu.paste.pasteData(new PrimitiveDeepCopy(getCurrentDataSet().getSelected()), getEditLayer(), e);
[626]29 }
[1023]30
[1820]31 @Override
32 protected void updateEnabledState() {
[2256]33 if (getCurrentDataSet() == null) {
34 setEnabled(false);
35 } else {
36 updateEnabledState(getCurrentDataSet().getSelected());
37 }
[1814]38 }
[2256]39
40 @Override
41 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
42 setEnabled(selection != null && !selection.isEmpty());
43 }
[626]44}
Note: See TracBrowser for help on using the repository browser.