Changeset 3092 in josm for trunk/src/org


Ignore:
Timestamp:
2010-03-07T14:34:27+01:00 (14 years ago)
Author:
Gubaer
Message:

fixed #4681: Open Street Bug Plugin Crashed

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java

    r3083 r3092  
    3232    }
    3333
     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    //
    3445    @Override
    35     protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    36         super.updateEnabledState(getData());
     46    protected void updateEnabledState() {
     47        setEnabled(getCurrentDataSet() != null);
    3748    }
    3849
    3950    @Override
    40     protected Collection<OsmPrimitive> getData() {
    41         return getCurrentDataSet().allModifiedPrimitives();
     51    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    4252    }
    4353}
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r3083 r3092  
    103103            setEnabled(false);
    104104        } else {
    105             updateEnabledState(getData());
     105            updateEnabledState(getCurrentDataSet().getSelected());
    106106        }
    107107    }
     
    118118        if (! isEnabled())
    119119            return;
    120         Collection<OsmPrimitive> selection = getData();
     120        Collection<OsmPrimitive> selection =getCurrentDataSet().getSelected();
    121121        if (selection.size() == 0) {
    122122            JOptionPane.showMessageDialog(
     
    130130        updatePrimitives(selection);
    131131    }
    132 
    133     protected Collection<OsmPrimitive> getData() {
    134         return getCurrentDataSet().getSelected();
    135     }
    136132}
Note: See TracChangeset for help on using the changeset viewer.