source: josm/trunk/src/org/openstreetmap/josm/actions/RedoAction.java@ 4077

Last change on this file since 4077 was 3810, checked in by jttt, 13 years ago

Fix #5862 on startup neither redo nor undo button are greyed out

  • 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.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
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 * Redoes the last command.
15 *
16 * @author imi
17 */
18public class RedoAction extends JosmAction {
19
20 /**
21 * Construct the action with "Redo" as label.
22 */
23 public RedoAction() {
24 super(tr("Redo"), "redo", tr("Redo the last undone action."),
25 Shortcut.registerShortcut("system:redo", tr("Edit: {0}", tr("Redo")), KeyEvent.VK_Y, Shortcut.GROUP_MENU), true);
26 setEnabled(false);
27 putValue("help", ht("/Action/Redo"));
28 }
29
30 public void actionPerformed(ActionEvent e) {
31 if (Main.map == null)
32 return;
33 Main.map.repaint();
34 Main.main.undoRedo.redo();
35 }
36
37 @Override
38 protected void updateEnabledState() {
39 setEnabled(Main.main != null && !Main.main.undoRedo.redoCommands.isEmpty());
40 }
41}
Note: See TracBrowser for help on using the repository browser.