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

Last change on this file since 1820 was 1820, checked in by Gubaer, 15 years ago

JosmAction is now a LayerChangeListener and a SelectionChangeListener
updated all JosmActions
fixed #3018: Make sure tools menu entries (and actions) are deactivated when no layer

  • Property svn:eol-style set to native
File size: 947 bytes
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2// Author: David Earl
3package org.openstreetmap.josm.actions;
4
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.tools.Shortcut;
11
12public final class DuplicateAction extends JosmAction{
13
14 public DuplicateAction() {
15 super(tr("Duplicate"), "duplicate",
16 tr("Duplicate selection by copy and immediate paste."),
17 Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.GROUP_MENU), true);
18 }
19
20 public void actionPerformed(ActionEvent e) {
21 new PasteAction().pasteData(new CopyAction().copyData(), getEditLayer(), e);
22 }
23
24
25 @Override
26 protected void updateEnabledState() {
27 setEnabled(getCurrentDataSet() != null && ! getCurrentDataSet().getSelected().isEmpty());
28 }
29}
Note: See TracBrowser for help on using the repository browser.