- Timestamp:
- 2010-03-07T14:34:27+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java
r3083 r3092 32 32 } 33 33 34 // FIXME: overrides the behaviour of UpdateSelectionAction. Doesn't update 35 // the enabled state based on the current selection because 36 // it doesn't depend on it. 37 // The action should be enabled/disabled based on whether there is a least 38 // one modified object in the current dataset. Unfortunately, there is no 39 // efficient way to find out here. getDataSet().allModifiedPrimitives() is 40 // too heavy weight because it loops over the whole dataset. 41 // Perhaps this action should be a DataSetListener? Or it could listen to the 42 // REQUIRES_SAVE_TO_DISK_PROP and REQUIRES_UPLOAD_TO_SERVER_PROP properties 43 // in the OsmLayer? 44 // 34 45 @Override 35 protected void updateEnabledState( Collection<? extends OsmPrimitive> selection) {36 s uper.updateEnabledState(getData());46 protected void updateEnabledState() { 47 setEnabled(getCurrentDataSet() != null); 37 48 } 38 49 39 50 @Override 40 protected Collection<OsmPrimitive> getData() { 41 return getCurrentDataSet().allModifiedPrimitives(); 51 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 42 52 } 43 53 } -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r3083 r3092 103 103 setEnabled(false); 104 104 } else { 105 updateEnabledState(get Data());105 updateEnabledState(getCurrentDataSet().getSelected()); 106 106 } 107 107 } … … 118 118 if (! isEnabled()) 119 119 return; 120 Collection<OsmPrimitive> selection = getData();120 Collection<OsmPrimitive> selection =getCurrentDataSet().getSelected(); 121 121 if (selection.size() == 0) { 122 122 JOptionPane.showMessageDialog( … … 130 130 updatePrimitives(selection); 131 131 } 132 133 protected Collection<OsmPrimitive> getData() {134 return getCurrentDataSet().getSelected();135 }136 132 }
Note:
See TracChangeset
for help on using the changeset viewer.