source: josm/trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java@ 3779

Last change on this file since 3779 was 3252, checked in by jttt, 14 years ago

Fix #2234: Translation can cause JosmActions to illegally handle shortcuts

  • Property svn:eol-style set to native
File size: 1.9 KB
RevLine 
[298]1// License: GPL. Copyright 2007 by Immanuel Scholz and others
[626]2package org.openstreetmap.josm.actions;
3
[3252]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;
[1865]9
[626]10import org.openstreetmap.josm.Main;
[1084]11import org.openstreetmap.josm.tools.Shortcut;
[626]12
[1820]13public class UnselectAllAction extends JosmAction {
[626]14
[1169]15 public UnselectAllAction() {
16 super(tr("Unselect All"), "unselectall", tr("Unselect all objects."),
[1808]17 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", tr("Unselect All")), KeyEvent.VK_U, Shortcut.GROUP_EDIT), true);
[1169]18 // this is not really GROUP_EDIT, but users really would complain if the yhad to reconfigure because we put
19 // the correct group in
[626]20
[1169]21 // Add extra shortcut C-S-a
[3252]22 Main.registerActionShortcut(this, Shortcut.registerShortcut("edit:unselectallfocus", tr("Edit: {0}", tr("Unselect All (Focus)")),
23 KeyEvent.VK_A, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT));
[626]24
[3252]25
26
[1169]27 // Add extra shortcut ESCAPE
28 /*
29 * FIXME: this isn't optimal. In a better world the mapmode actions
30 * would be able to capture keyboard events and react accordingly. But
31 * for now this is a reasonable approximation.
32 */
[3252]33 Main.registerActionShortcut(this, Shortcut.registerShortcut("edit:unselectallescape", tr("Edit: {0}", tr("Unselect All (Escape)")),
34 KeyEvent.VK_ESCAPE, Shortcut.GROUP_DIRECT));
[2512]35
[2323]36 putValue("help", ht("/Action/UnselectAll"));
[1169]37 }
[768]38
[1169]39 public void actionPerformed(ActionEvent e) {
[1808]40 if (!isEnabled())
41 return;
[1814]42 getCurrentDataSet().setSelected();
[1169]43 }
[1808]44 /**
45 * Refreshes the enabled state
[2512]46 *
[1808]47 */
[1820]48 @Override
49 protected void updateEnabledState() {
[1814]50 setEnabled(getEditLayer() != null);
[1808]51 }
[626]52}
Note: See TracBrowser for help on using the repository browser.