1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 | import javax.swing.KeyStroke;
|
---|
9 | import javax.swing.JComponent;
|
---|
10 |
|
---|
11 | import org.openstreetmap.josm.Main;
|
---|
12 |
|
---|
13 | public class UnselectAllAction extends JosmAction {
|
---|
14 |
|
---|
15 | public UnselectAllAction() {
|
---|
16 | super(tr("Unselect All"), "unselectall", tr("Unselect all objects."),
|
---|
17 | KeyEvent.VK_U, 0, true);
|
---|
18 |
|
---|
19 | // Add extra shortcut C-S-a
|
---|
20 | Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
|
---|
21 | KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK
|
---|
22 | | KeyEvent.SHIFT_DOWN_MASK), tr("Unselect All"));
|
---|
23 |
|
---|
24 | // Add extra shortcut ESCAPE
|
---|
25 | /*
|
---|
26 | * FIXME: this isn't optimal. In a better world the mapmode actions
|
---|
27 | * would be able to capture keyboard events and react accordingly. But
|
---|
28 | * for now this is a reasonable approximation.
|
---|
29 | */
|
---|
30 | Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
|
---|
31 | KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
---|
32 | tr("Unselect All"));
|
---|
33 | }
|
---|
34 |
|
---|
35 | public void actionPerformed(ActionEvent e) {
|
---|
36 | Main.ds.setSelected();
|
---|
37 | }
|
---|
38 | }
|
---|