Ticket #17740: 17740.patch
| File 17740.patch, 1.8 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
96 96 import org.openstreetmap.josm.tools.Logging; 97 97 import org.openstreetmap.josm.tools.PlatformManager; 98 98 import org.openstreetmap.josm.tools.Shortcut; 99 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 99 100 import org.openstreetmap.josm.tools.Utils; 100 101 101 102 /** … … 264 265 */ 265 266 public void editTag(final int row, boolean focusOnKey) { 266 267 changedKey = null; 267 sel = OsmDataManager.getInstance().getInProgressSelection();268 sel = checkForBadPrimitives(OsmDataManager.getInstance().getInProgressSelection()); 268 269 if (sel == null || sel.isEmpty()) 269 270 return; 270 271 … … 279 280 } 280 281 281 282 /** 283 * Ensure that all OsmPrimitives in sel can be used elsewhere 284 * @param <T> Some class T that extends {@link OsmPrimitive} 285 * @param sel The collection of objects that may have bad primitives 286 * @return A collection of objects without null objects, deleted objects, and objects without DataSets. 287 */ 288 private static <T extends OsmPrimitive> Collection<T> checkForBadPrimitives(Collection<T> sel) { 289 // !p.isDeleted duplicates what OsmDataManager.getInstance().getInProgressSelection() does 290 if (sel != null) { 291 return new SubclassFilteredCollection<>(sel, p -> p != null && !p.isDeleted() && p.getDataSet() != null); 292 } else { 293 return Collections.emptyList(); 294 } 295 } 296 297 /** 282 298 * Extracted interface of {@link EditTagDialog}. 283 299 */ 284 300 protected interface IEditTagDialog extends IExtendedDialog {
