Ticket #15707: no_exception_for_empty_selection2.patch
| File no_exception_for_empty_selection2.patch, 3.0 KB (added by , 8 years ago) |
|---|
-
src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
171 171 }); 172 172 } 173 173 174 final Collection<OsmPrimitive> forTagAdd = new HashSet<>(); 174 final Collection<OsmPrimitive> forTagAdd = new HashSet<>(); // these objects will receive new tags 175 175 final Bounds bbox = new Bounds(minlat, minlon, maxlat, maxlon); 176 176 if (args.containsKey("select") && PermissionPrefWithDefault.CHANGE_SELECTION.isAllowed()) { 177 177 // select objects after downloading, zoom to selection. 178 178 GuiHelper.executeByMainWorkerInEDT(() -> { 179 Set<OsmPrimitive> newSel = new HashSet<>(); 179 Set<OsmPrimitive> newSel = new HashSet<>(); // these objects will be selected later on 180 180 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 181 181 if (ds == null) // e.g. download failed 182 182 return; … … 193 193 forTagAdd.addAll(sel); 194 194 } 195 195 toSelect.clear(); 196 isKeepingCurrentSelection = false;197 196 ds.setSelected(newSel); 198 197 zoom(newSel, bbox); 199 198 MapFrame map = MainApplication.getMap(); … … 236 235 }); 237 236 } 238 237 239 AddTagsDialog.addTags(args, sender, forTagAdd); 238 // needs to run in EDT since forTagAdd is updated in EDT as well 239 GuiHelper.executeByMainWorkerInEDT(() -> { 240 if (forTagAdd.size() > 0) { 241 AddTagsDialog.addTags(args, sender, forTagAdd); 242 } else if (isKeepingCurrentSelection && args.containsKey("addtags")) { 243 // TODO: see #15707, display error message: 244 // You clicked on a JOSM remotecontrol link that would apply tags onto selected objects. 245 // Since no objects were selected, no tags were added. Select one or more objects and click the link again. 246 Logging.warn("RemoteControl: addtags= is set, but forTagAdd is empty (isKeepingCurrentSelection is set)"); 247 } else if (!isKeepingCurrentSelection && args.containsKey("addtags")) { 248 // TODO: see #15707, display error message: 249 // You clicked on a JOSM remotecontrol link that would apply tags onto selected objects. 250 // This link seems to be broken due to an invalid value of the query parameter 'select='. 251 // Ask at the source of the link if it can be fixed. 252 Logging.warn("RemoteControl: addtags= is set, but forTagAdd is empty (isKeepingCurrentSelection is not set)"); 253 } 254 }); 255 240 256 } 241 257 242 258 protected void zoom(Collection<OsmPrimitive> primitives, final Bounds bbox) {
