Changeset 12769 in josm


Ignore:
Timestamp:
2017-09-07T21:01:54+02:00 (3 weeks ago)
Author:
Don-vip
Message:

fix #15262 - see #13036 - fix regression in ChangePropertyCommand + optimize commands creation when pasting tags

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

Legend:

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

    r12726 r12769  
    140140
    141141                if (newVal == null || newVal.isEmpty()) {
    142                     if (oldVal != null)
     142                    if (oldVal != null) {
    143143                        // new value is null and tag exists (will delete tag)
    144144                        modified = true;
    145                 } else if (oldVal == null || !newVal.equals(oldVal))
     145                        break;
     146                    }
     147                } else if (oldVal == null || !newVal.equals(oldVal)) {
    146148                    // new value is not null and is different from current value
    147149                    modified = true;
     150                    break;
     151                }
    148152            }
    149153            if (modified)
     
    154158    @Override
    155159    public boolean executeCommand() {
     160        if (objects.isEmpty())
     161            return true;
    156162        final DataSet dataSet = objects.get(0).getDataSet();
    157163        if (dataSet != null) {
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveTagTransferPaster.java

    r12720 r12769  
    2727
    2828/**
    29  * This class helps pasting tags form other primitives. It handles resolving conflicts.
     29 * This class helps pasting tags from other primitives. It handles resolving conflicts.
    3030 * @author Michael Zangl
    3131 * @since 10737
     
    5050        List<Command> commands = new ArrayList<>();
    5151        for (Tag tag : tagPaster.execute()) {
    52             commands.add(new ChangePropertyCommand(selection, tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue()));
     52            ChangePropertyCommand cmd = new ChangePropertyCommand(selection, tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue());
     53            if (cmd.getObjectsNumber() > 0) {
     54                commands.add(cmd);
     55            }
    5356        }
    5457        commitCommands(selection, commands);
Note: See TracChangeset for help on using the changeset viewer.