001 // License: GPL. Copyright 2007 by Immanuel Scholz and others 002 package org.openstreetmap.josm.actions; 003 004 import static org.openstreetmap.josm.tools.I18n.tr; 005 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 006 007 import java.awt.event.ActionEvent; 008 import java.awt.event.KeyEvent; 009 010 import org.openstreetmap.josm.tools.Shortcut; 011 012 public 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 public void actionPerformed(ActionEvent e) { 021 if (!isEnabled()) 022 return; 023 getCurrentDataSet().setSelected(getCurrentDataSet().allNonDeletedCompletePrimitives()); 024 } 025 026 /** 027 * Refreshes the enabled state 028 * 029 */ 030 @Override 031 protected void updateEnabledState() { 032 setEnabled(getEditLayer() != null); 033 } 034 }