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

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