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

Last change on this file since 3718 was 2323, checked in by Gubaer, 14 years ago

Added explicit help topics
See also current list of help topics with links to source files and to help pages

  • Property svn:eol-style set to native
File size: 1.1 KB
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;
5import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.tools.Shortcut;
12
13/**
14 * Undoes the last command.
15 *
16 * @author imi
17 */
18public class UndoAction extends JosmAction {
19
20 /**
21 * Construct the action with "Undo" as label.
22 */
23 public UndoAction() {
24 super(tr("Undo"), "undo", tr("Undo the last action."),
25 Shortcut.registerShortcut("system:undo", tr("Edit: {0}", tr("Undo")), KeyEvent.VK_Z, Shortcut.GROUP_MENU), true);
26 setEnabled(false);
27 putValue("help", ht("/Action/Undo"));
28 }
29
30 public void actionPerformed(ActionEvent e) {
31 if (Main.map == null)
32 return;
33 Main.map.repaint();
34 Main.main.undoRedo.undo();
35 }
36
37 @Override
38 protected void updateEnabledState() {
39 setEnabled(Main.map != null);
40 }
41}
Note: See TracBrowser for help on using the repository browser.