diff --git a/src/org/openstreetmap/josm/command/Command.java b/src/org/openstreetmap/josm/command/Command.java
index 514ec5f..404f59a 100644
a
|
b
|
abstract public class Command extends PseudoCommand {
|
176 | 176 | */ |
177 | 177 | public static boolean checkAndConfirmOutlyingOperation(String operation, |
178 | 178 | String dialogTitle, String outsideDialogMessage, String incompleteDialogMessage, |
179 | | Area area, Collection<? extends OsmPrimitive> primitives, OsmPrimitive ignore) { |
| 179 | Area area, Collection<? extends OsmPrimitive> primitives, |
| 180 | Collection<? extends OsmPrimitive> ignore) { |
180 | 181 | boolean outside = false; |
181 | 182 | boolean incomplete = false; |
182 | | if (area != null) { |
183 | | for (OsmPrimitive osm : primitives) { |
184 | | if (osm.isIncomplete()) { |
185 | | incomplete = true; |
186 | | } else if (isOutlying(osm, area) |
187 | | && (ignore == null || !ignore.equals(osm))) { |
188 | | outside = true; |
189 | | } |
190 | | } |
191 | | } else { |
192 | | for (OsmPrimitive osm : primitives) { |
193 | | if (osm.isIncomplete()) { |
194 | | incomplete = true; |
195 | | } |
| 183 | for (OsmPrimitive osm : primitives) { |
| 184 | if (osm.isIncomplete()) { |
| 185 | incomplete = true; |
| 186 | } else if (area != null && isOutlying(osm, area) |
| 187 | && (ignore == null || !ignore.contains(osm))) { |
| 188 | outside = true; |
196 | 189 | } |
197 | 190 | } |
198 | 191 | if (outside) { |
diff --git a/src/org/openstreetmap/josm/command/DeleteCommand.java b/src/org/openstreetmap/josm/command/DeleteCommand.java
index e6751cc..a3aefc5 100644
a
|
b
|
public class DeleteCommand extends Command {
|
357 | 357 | primitivesToDelete.addAll(nodesToDelete); |
358 | 358 | } |
359 | 359 | |
360 | | if (!silent && !checkAndConfirmOutlyingDelete(layer, primitivesToDelete, null)) |
| 360 | if (!silent && !checkAndConfirmOutlyingDelete(layer, |
| 361 | primitivesToDelete, Utils.filteredCollection(primitivesToDelete, Way.class))) |
361 | 362 | return null; |
362 | 363 | |
363 | 364 | waysToBeChanged.addAll(OsmPrimitive.getFilteredSet(OsmPrimitive.getReferrer(primitivesToDelete), Way.class)); |
… |
… |
public class DeleteCommand extends Command {
|
453 | 454 | } |
454 | 455 | } |
455 | 456 | |
456 | | public static boolean checkAndConfirmOutlyingDelete(OsmDataLayer layer, Collection<? extends OsmPrimitive> primitives, OsmPrimitive ignore) { |
| 457 | public static boolean checkAndConfirmOutlyingDelete(OsmDataLayer layer, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) { |
457 | 458 | return checkAndConfirmOutlyingDelete(layer.data.getDataSourceArea(), primitives, ignore); |
458 | 459 | } |
459 | 460 | |
460 | | public static boolean checkAndConfirmOutlyingDelete(Area area, Collection<? extends OsmPrimitive> primitives, OsmPrimitive ignore) { |
| 461 | public static boolean checkAndConfirmOutlyingDelete(Area area, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) { |
461 | 462 | return Command.checkAndConfirmOutlyingOperation("delete", |
462 | 463 | tr("Delete confirmation"), |
463 | 464 | tr("You are about to delete nodes outside of the area you have downloaded." |
diff --git a/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java b/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
index 584a584..41acc1b 100644
a
|
b
|
import static org.openstreetmap.josm.tools.I18n.tr;
|
6 | 6 | |
7 | 7 | import java.util.ArrayList; |
8 | 8 | import java.util.Collection; |
| 9 | import java.util.Collections; |
9 | 10 | import java.util.HashMap; |
10 | 11 | import java.util.Iterator; |
11 | 12 | import java.util.LinkedHashSet; |
… |
… |
public class DuplicateNode extends Test {
|
383 | 384 | target = nodes.iterator().next(); |
384 | 385 | } |
385 | 386 | |
386 | | if (DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getCurrentDataSet().getDataSourceArea(), nodes, target)) |
| 387 | if (DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getCurrentDataSet().getDataSourceArea(), nodes, Collections.singleton(target))) |
387 | 388 | return MergeNodesAction.mergeNodes(Main.main.getEditLayer(), nodes, target); |
388 | 389 | |
389 | 390 | return null;// undoRedo handling done in mergeNodes |