source: josm/trunk/src/org/openstreetmap/josm/actions/UndoAction.java@ 2001

Last change on this file since 2001 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: 997 bytes
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7import java.awt.event.KeyEvent;
8
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.tools.Shortcut;
11
12/**
13 * Undoes the last command.
14 *
15 * @author imi
16 */
17public class UndoAction extends JosmAction {
18
19 /**
20 * Construct the action with "Undo" as label.
21 */
22 public UndoAction() {
23 super(tr("Undo"), "undo", tr("Undo the last action."),
24 Shortcut.registerShortcut("system:undo", tr("Edit: {0}", tr("Undo")), KeyEvent.VK_Z, Shortcut.GROUP_MENU), true);
25 setEnabled(false);
26 }
27
28 public void actionPerformed(ActionEvent e) {
29 if (Main.map == null)
30 return;
31 Main.map.repaint();
32 Main.main.undoRedo.undo();
33 }
34
35 @Override
36 protected void updateEnabledState() {
37 setEnabled(Main.map != null);
38 }
39}
Note: See TracBrowser for help on using the repository browser.