001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.actions; 003 004import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 005import static org.openstreetmap.josm.tools.I18n.tr; 006 007import java.awt.event.ActionEvent; 008import java.awt.event.KeyEvent; 009 010import org.openstreetmap.josm.tools.Shortcut; 011 012public class UnselectAllAction extends JosmAction { 013 014 public UnselectAllAction() { 015 super(tr("Unselect All"), "unselectall", tr("Unselect all objects."), 016 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", 017 tr("Unselect All")), KeyEvent.VK_ESCAPE, Shortcut.DIRECT), true); 018 019 putValue("help", ht("/Action/UnselectAll")); 020 } 021 022 @Override 023 public void actionPerformed(ActionEvent e) { 024 if (!isEnabled()) 025 return; 026 getCurrentDataSet().setSelected(); 027 } 028 /** 029 * Refreshes the enabled state 030 * 031 */ 032 @Override 033 protected void updateEnabledState() { 034 setEnabled(getEditLayer() != null); 035 } 036}