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

Last change on this file since 2610 was 2512, checked in by stoecker, 14 years ago

i18n updated, fixed files to reduce problems when applying patches, fix #4017

  • Property svn:eol-style set to native
File size: 2.1 KB
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;
5import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import javax.swing.JComponent;
11
12import org.openstreetmap.josm.Main;
13import org.openstreetmap.josm.tools.Shortcut;
14
15public class UnselectAllAction extends JosmAction {
16
17 public UnselectAllAction() {
18 super(tr("Unselect All"), "unselectall", tr("Unselect all objects."),
19 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", tr("Unselect All")), KeyEvent.VK_U, Shortcut.GROUP_EDIT), true);
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
22
23 // Add extra shortcut C-S-a
24 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
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"));
28
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(
36 Shortcut.registerShortcut("edit:unselectallescape", tr("Edit: {0}", tr("Unselect All (Escape)")),
37 KeyEvent.VK_ESCAPE, Shortcut.GROUP_DIRECT).getKeyStroke(),
38 tr("Unselect All"));
39
40 putValue("help", ht("/Action/UnselectAll"));
41 }
42
43 public void actionPerformed(ActionEvent e) {
44 if (!isEnabled())
45 return;
46 getCurrentDataSet().setSelected();
47 }
48 /**
49 * Refreshes the enabled state
50 *
51 */
52 @Override
53 protected void updateEnabledState() {
54 setEnabled(getEditLayer() != null);
55 }
56}
Note: See TracBrowser for help on using the repository browser.