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

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

add AbstractOsmDataLayer, MainLayerManager.getActiveData, Main.getInProgressISelection

  • Property svn:eol-style set to native
File size: 1.1 KB
RevLine 
[6380]1// License: GPL. For details, see LICENSE file.
[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
[1084]10import org.openstreetmap.josm.tools.Shortcut;
[626]11
[12581]12/**
13 * User action to clear the current selection.
14 */
[1820]15public class UnselectAllAction extends JosmAction {
[626]16
[9059]17 /**
18 * Constructs a new {@code UnselectAllAction}.
19 */
[1169]20 public UnselectAllAction() {
21 super(tr("Unselect All"), "unselectall", tr("Unselect all objects."),
[4958]22 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}",
[4982]23 tr("Unselect All")), KeyEvent.VK_ESCAPE, Shortcut.DIRECT), true);
[626]24
[2323]25 putValue("help", ht("/Action/UnselectAll"));
[1169]26 }
[768]27
[6084]28 @Override
[1169]29 public void actionPerformed(ActionEvent e) {
[1808]30 if (!isEnabled())
31 return;
[13926]32 getLayerManager().getActiveData().setSelected();
[1169]33 }
[9059]34
[1808]35 /**
36 * Refreshes the enabled state
37 */
[1820]38 @Override
39 protected void updateEnabledState() {
[13926]40 setEnabled(getLayerManager().getActiveData() != null);
[1808]41 }
[626]42}
Note: See TracBrowser for help on using the repository browser.