Ignore:
Timestamp:
2017-12-17T20:27:00+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #15676 - Remote Control: add new keyword currentselection for parameter select in LoadAndZoomHandler (patch by skorbut, modified)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r13109 r13212  
    1010import java.util.Collections;
    1111import java.util.HashSet;
     12import java.util.Locale;
    1213import java.util.Set;
    1314import java.util.concurrent.Future;
     
    6061    // Optional argument 'select'
    6162    private final Set<SimplePrimitiveId> toSelect = new HashSet<>();
     63
     64    private Boolean isKeepingCurrentSelection = false;
    6265
    6366    @Override
     
    160163         * deselect objects if parameter addtags given
    161164         */
    162         if (args.containsKey("addtags")) {
     165        if (args.containsKey("addtags") && !isKeepingCurrentSelection) {
    163166            GuiHelper.executeByMainWorkerInEDT(() -> {
    164167                DataSet ds = MainApplication.getLayerManager().getEditDataSet();
     
    185188                    }
    186189                }
     190                if (isKeepingCurrentSelection) {
     191                    Collection<OsmPrimitive> sel = ds.getSelected();
     192                    newSel.addAll(sel);
     193                    forTagAdd.addAll(sel);
     194                }
    187195                toSelect.clear();
     196                isKeepingCurrentSelection = false;
    188197                ds.setSelected(newSel);
    189198                zoom(newSel, bbox);
     
    287296            for (String item : args.get("select").split(",")) {
    288297                if (!item.isEmpty()) {
     298                    if ("currentselection".equals(item.toLowerCase(Locale.ENGLISH))) {
     299                        isKeepingCurrentSelection = true;
     300                        continue;
     301                    }
    289302                    try {
    290303                        toSelect.add(SimplePrimitiveId.fromString(item));
Note: See TracChangeset for help on using the changeset viewer.