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