Ignore:
Timestamp:
2019-01-03T12:52:40+01:00 (6 years ago)
Author:
stoecker
Message:

fix #josm17158 - wrong order of commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/Building.java

    r34724 r34807  
    337337        w = ways.get(0);
    338338
    339         addAddress(w);
     339        addAddress(w, null);
    340340
    341341        return w;
     
    386386        cmds.add(new AddCommand(ds, w));
    387387
    388         addAddress(w);
     388        addAddress(w, cmds);
    389389
    390390        if (snap) {
     
    452452    }
    453453
    454     private void addAddress(Way w) {
     454    private void addAddress(Way w, Collection<Command> cmdList) {
    455455        if (ToolSettings.PROP_USE_ADDR_NODE.get()) {
    456456            Node addrNode = getAddressNode();
    457457            if (addrNode != null) {
    458                 Collection<Command> addressCmds = new LinkedList<>();
     458                Collection<Command> addressCmds = cmdList != null ? cmdList : new LinkedList<>();
    459459                for (Entry<String, String> entry : addrNode.getKeys().entrySet()) {
    460460                    w.put(entry.getKey(), entry.getValue());
     
    473473                }
    474474                addressCmds.add(new DeleteCommand(addrNode));
    475                 Command c = new SequenceCommand(tr("Add address for building"), addressCmds);
    476                 UndoRedoHandler.getInstance().add(c);
     475                if (cmdList == null) {
     476                    Command c = new SequenceCommand(tr("Add address for building"), addressCmds);
     477                    UndoRedoHandler.getInstance().add(c);
     478                }
    477479            }
    478480        }
Note: See TracChangeset for help on using the changeset viewer.