Changeset 3317 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2010-06-08T15:42:33+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r3262 r3317 439 439 private static boolean checkAndConfirmOutlyingDeletes(OsmDataLayer layer, Collection<OsmPrimitive> primitivesToDelete) { 440 440 Area a = layer.data.getDataSourceArea(); 441 boolean outside = false; 442 boolean incomplete = false; 441 443 if (a != null) { 442 444 for (OsmPrimitive osm : primitivesToDelete) { 443 if (osm instanceof Node && !osm.isNew()) { 444 Node n = (Node) osm; 445 if (!a.contains(n.getCoor())) { 446 JPanel msg = new JPanel(new GridBagLayout()); 447 msg.add(new JLabel( 448 "<html>" + 449 // leave message in one tr() as there is a grammatical 450 // connection. 451 tr("You are about to delete nodes outside of the area you have downloaded." 452 + "<br>" 453 + "This can cause problems because other objects (that you do not see) might use them." 454 + "<br>" + "Do you really want to delete?") + "</html>")); 455 return ConditionalOptionPaneUtil.showConfirmationDialog( 456 "delete_outside_nodes", 457 Main.parent, 458 msg, 459 tr("Delete confirmation"), 460 JOptionPane.YES_NO_OPTION, 461 JOptionPane.QUESTION_MESSAGE, 462 JOptionPane.YES_OPTION 463 ); 464 } 465 } 466 } 445 if (osm.isIncomplete()) 446 incomplete = true; 447 else if (osm instanceof Node && !osm.isNew() 448 && !a.contains(((Node) osm).getCoor())) 449 outside = true; 450 } 451 } 452 else 453 { 454 for (OsmPrimitive osm : primitivesToDelete) 455 if (osm.isIncomplete()) 456 incomplete = true; 457 } 458 if(outside) 459 { 460 JPanel msg = new JPanel(new GridBagLayout()); 461 msg.add(new JLabel( 462 "<html>" + 463 // leave message in one tr() as there is a grammatical 464 // connection. 465 tr("You are about to delete nodes outside of the area you have downloaded." 466 + "<br>" 467 + "This can cause problems because other objects (that you do not see) might use them." 468 + "<br>" + "Do you really want to delete?") + "</html>")); 469 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 470 "delete_outside_nodes", 471 Main.parent, 472 msg, 473 tr("Delete confirmation"), 474 JOptionPane.YES_NO_OPTION, 475 JOptionPane.QUESTION_MESSAGE, 476 JOptionPane.YES_OPTION 477 ); 478 if(!answer) 479 return false; 480 } 481 if(incomplete) 482 { 483 JPanel msg = new JPanel(new GridBagLayout()); 484 msg.add(new JLabel( 485 "<html>" + 486 // leave message in one tr() as there is a grammatical 487 // connection. 488 tr("You are about to delete incomplete objects." 489 + "<br>" 490 + "This will cause problems because you don't see the real object." 491 + "<br>" + "Do you really want to delete?") + "</html>")); 492 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 493 "delete_incomplete", 494 Main.parent, 495 msg, 496 tr("Delete confirmation"), 497 JOptionPane.YES_NO_OPTION, 498 JOptionPane.QUESTION_MESSAGE, 499 JOptionPane.YES_OPTION 500 ); 501 if(!answer) 502 return false; 467 503 } 468 504 return true;
Note: See TracChangeset
for help on using the changeset viewer.