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

Last change on this file since 604 was 301, checked in by imi, 17 years ago
  • fixed undo/redo to be global
  • fixed adding of objects work with undo/redo (#212)
File size: 778 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.InputEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.Main;
11
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."), KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK, 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}
Note: See TracBrowser for help on using the repository browser.