Ignore:
Timestamp:
2023-07-24T17:55:34+02:00 (2 years ago)
Author:
taylor.smock
Message:

reltoolbox: Preferentially use the source relation dataset

If the source relation does not have a dataset, use the current edit dataset instead.

This also adds some basic tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/AssociatedStreetFixer.java

    r36102 r36103  
    1212import org.openstreetmap.josm.command.Command;
    1313import org.openstreetmap.josm.command.SequenceCommand;
     14import org.openstreetmap.josm.data.osm.DataSet;
    1415import org.openstreetmap.josm.data.osm.Node;
    1516import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    1819import org.openstreetmap.josm.data.osm.Way;
    1920import org.openstreetmap.josm.gui.MainApplication;
     21import org.openstreetmap.josm.tools.Utils;
    2022
    2123public class AssociatedStreetFixer extends RelationFixer {
     
    135137        List<Command> commandList = new ArrayList<>();
    136138        if (fixed) {
    137             commandList.add(new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), source, rel));
     139            final DataSet ds = Utils.firstNonNull(source.getDataSet(), MainApplication.getLayerManager().getEditDataSet());
     140            commandList.add(new ChangeCommand(ds, source, rel));
    138141        }
    139142
Note: See TracChangeset for help on using the changeset viewer.