Changeset 1808 in josm for trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java
- Timestamp:
- 2009-07-19T10:31:27+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java
r1308 r1808 8 8 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.gui.layer.Layer; 11 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 10 12 import org.openstreetmap.josm.tools.Shortcut; 11 13 12 public class SelectAllAction extends JosmAction {14 public class SelectAllAction extends JosmAction implements LayerChangeListener{ 13 15 14 16 public SelectAllAction() { 15 17 super(tr("Select All"),"selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."), 16 Shortcut.registerShortcut("system:selectall", tr("Edit: {0}", tr("Select All")), KeyEvent.VK_A, Shortcut.GROUP_MENU), true); 18 Shortcut.registerShortcut("system:selectall", tr("Edit: {0}", tr("Select All")), KeyEvent.VK_A, Shortcut.GROUP_MENU), true); 19 Layer.listeners.add(this); 20 refreshEnabled(); 17 21 } 18 22 19 23 public void actionPerformed(ActionEvent e) { 24 if (!isEnabled()) 25 return; 20 26 Main.ds.setSelected(Main.ds.allNonDeletedCompletePrimitives()); 21 27 } 28 29 /** 30 * Refreshes the enabled state 31 * 32 */ 33 protected void refreshEnabled() { 34 setEnabled(Main.map != null 35 && Main.map.mapView !=null 36 && Main.map.mapView.getEditLayer() != null 37 ); 38 } 39 40 /* ---------------------------------------------------------------------------------- */ 41 /* Interface LayerChangeListener */ 42 /* ---------------------------------------------------------------------------------- */ 43 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 44 refreshEnabled(); 45 } 46 47 public void layerAdded(Layer newLayer) { 48 refreshEnabled(); 49 } 50 51 public void layerRemoved(Layer oldLayer) { 52 refreshEnabled(); 53 } 22 54 }
Note:
See TracChangeset
for help on using the changeset viewer.