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

Last change on this file since 13792 was 13434, checked in by Don-vip, 6 years ago

see #8039, see #10456 - support read-only data layers

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.tools.Shortcut;
11
12/**
13 * User action to clear the current selection.
14 */
15public class UnselectAllAction extends JosmAction {
16
17 /**
18 * Constructs a new {@code UnselectAllAction}.
19 */
20 public UnselectAllAction() {
21 super(tr("Unselect All"), "unselectall", tr("Unselect all objects."),
22 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}",
23 tr("Unselect All")), KeyEvent.VK_ESCAPE, Shortcut.DIRECT), true);
24
25 putValue("help", ht("/Action/UnselectAll"));
26 }
27
28 @Override
29 public void actionPerformed(ActionEvent e) {
30 if (!isEnabled())
31 return;
32 getLayerManager().getActiveDataSet().setSelected();
33 }
34
35 /**
36 * Refreshes the enabled state
37 */
38 @Override
39 protected void updateEnabledState() {
40 setEnabled(getLayerManager().getActiveDataSet() != null);
41 }
42}
Note: See TracBrowser for help on using the repository browser.