Changeset 16970 in osm for applications
- Timestamp:
- 2009-08-10T13:40:31+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java
r16629 r16970 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import java.awt.geom.Area; 4 6 5 7 import java.util.Collection; … … 7 9 import java.util.List; 8 10 11 import javax.swing.JOptionPane; 12 13 import org.openstreetmap.josm.Main; 9 14 import org.openstreetmap.josm.actions.MergeNodesAction; 10 15 import org.openstreetmap.josm.command.Command; … … 12 17 import org.openstreetmap.josm.data.osm.Node; 13 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 14 20 import org.openstreetmap.josm.plugins.validator.Severity; 15 21 import org.openstreetmap.josm.plugins.validator.Test; … … 93 99 target = nodes.iterator().next(); 94 100 95 new MergeNodesAction().mergeNodes(nodes, target); 101 if(checkAndConfirmOutlyingDeletes(nodes)) 102 new MergeNodesAction().mergeNodes(nodes, target); 96 103 97 104 return null; // undoRedo handling done in mergeNodes … … 103 110 return (testError.getTester() instanceof DuplicateNode); 104 111 } 112 113 /** 114 * Check whether user is about to delete data outside of the download area. 115 * Request confirmation if he is. 116 */ 117 private static boolean checkAndConfirmOutlyingDeletes(LinkedList<Node> del) { 118 Area a = Main.main.getCurrentDataSet().getDataSourceArea(); 119 if (a != null) { 120 for (OsmPrimitive osm : del) { 121 if (osm instanceof Node && osm.id != 0) { 122 Node n = (Node) osm; 123 if (!a.contains(n.getCoor())) { 124 return ConditionalOptionPaneUtil.showConfirmationDialog( 125 "delete_outside_nodes", 126 Main.parent, 127 tr("You are about to delete nodes outside of the area you have downloaded." + 128 "<br>" + 129 "This can cause problems because other objects (that you don't see) might use them." + 130 "<br>" + 131 "Do you really want to delete?") + "</html>", 132 tr("Confirmation"), 133 JOptionPane.YES_NO_OPTION, 134 JOptionPane.QUESTION_MESSAGE, 135 JOptionPane.YES_OPTION); 136 } 137 } 138 } 139 } 140 return true; 141 } 105 142 }
Note:
See TracChangeset
for help on using the changeset viewer.