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

Last change on this file since 4613 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
RevLine 
[298]1// License: GPL. Copyright 2007 by Immanuel Scholz and others
[626]2package org.openstreetmap.josm.actions;
3
[3810]4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
[626]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;
[1084]11import org.openstreetmap.josm.tools.Shortcut;
[626]12
13/**
14 * Redoes the last command.
[1023]15 *
[626]16 * @author imi
17 */
18public class RedoAction extends JosmAction {
19
[1169]20 /**
21 * Construct the action with "Redo" as label.
22 */
23 public RedoAction() {
24 super(tr("Redo"), "redo", tr("Redo the last undone action."),
[1820]25 Shortcut.registerShortcut("system:redo", tr("Edit: {0}", tr("Redo")), KeyEvent.VK_Y, Shortcut.GROUP_MENU), true);
[1169]26 setEnabled(false);
[2323]27 putValue("help", ht("/Action/Redo"));
[1169]28 }
[626]29
[1169]30 public void actionPerformed(ActionEvent e) {
31 if (Main.map == null)
32 return;
33 Main.map.repaint();
34 Main.main.undoRedo.redo();
35 }
[1820]36
37 @Override
38 protected void updateEnabledState() {
[3810]39 setEnabled(Main.main != null && !Main.main.undoRedo.redoCommands.isEmpty());
[1820]40 }
[626]41}
Note: See TracBrowser for help on using the repository browser.