Ignore:
Timestamp:
2016-06-24T00:30:42+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #13037 - Small fixes for unit tests (patch by michael2402) - gsoc-core

Location:
trunk/src/org/openstreetmap/josm/command
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/AddCommand.java

    r9371 r10467  
    5959    @Override
    6060    public boolean executeCommand() {
    61         getLayer().data.addPrimitive(osm);
     61        getAffectedDataSet().addPrimitive(osm);
    6262        osm.setModified(true);
    6363        checkNodeStyles(osm);
     
    6767    @Override
    6868    public void undoCommand() {
    69         getLayer().data.removePrimitive(osm);
     69        getAffectedDataSet().removePrimitive(osm);
    7070        checkNodeStyles(osm);
    7171    }
  • trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java

    r9371 r10467  
    7878
    7979            for (PrimitiveData pd : data) {
    80                 OsmPrimitive primitive = getLayer().data.getPrimitiveById(pd);
     80                OsmPrimitive primitive = getAffectedDataSet().getPrimitiveById(pd);
    8181                boolean created = primitive == null;
    8282                if (created) {
     
    8787                }
    8888                if (created) {
    89                     getLayer().data.addPrimitive(primitive);
     89                    getAffectedDataSet().addPrimitive(primitive);
    9090                }
    9191                newPrimitives.add(primitive);
     
    115115
    116116    @Override public void undoCommand() {
    117         DataSet ds = getLayer().data;
     117        DataSet ds = getAffectedDataSet();
    118118
    119119        if (createdPrimitives == null) {
     
    167167        Collection<OsmPrimitive> prims = new HashSet<>();
    168168        for (PrimitiveData d : data) {
    169             OsmPrimitive osm = getLayer().data.getPrimitiveById(d);
     169            OsmPrimitive osm = getAffectedDataSet().getPrimitiveById(d);
    170170            if (osm == null)
    171171                throw new RuntimeException();
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r10452 r10467  
    1717import org.openstreetmap.josm.data.coor.EastNorth;
    1818import org.openstreetmap.josm.data.coor.LatLon;
     19import org.openstreetmap.josm.data.osm.DataSet;
    1920import org.openstreetmap.josm.data.osm.Node;
    2021import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    210211    protected OsmDataLayer getLayer() {
    211212        return layer;
     213    }
     214
     215    /**
     216     * Gets the data set this command affects.
     217     * @return The data set. May be <code>null</code> if no layer was set and no edit layer was found.
     218     * @since 10467
     219     */
     220    public DataSet getAffectedDataSet() {
     221        return layer == null ? null : layer.data;
    212222    }
    213223
  • trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java

    r9371 r10467  
    5959        //
    6060        for (Node n:mergedNodeList) {
    61             if (!getLayer().data.getNodes().contains(n)) {
     61            if (!getAffectedDataSet().getNodes().contains(n)) {
    6262                Main.warn(tr("Main dataset does not include node {0}", n.toString()));
    6363            }
Note: See TracChangeset for help on using the changeset viewer.