Changeset 4677 in josm for trunk/src/org
- Timestamp:
- 2011-12-21T10:13:49+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r4458 r4677 2 2 package org.openstreetmap.josm.command; 3 3 4 import java.awt.GridBagLayout; 4 5 import java.awt.geom.Area; 5 6 import static org.openstreetmap.josm.tools.I18n.marktr; … … 21 22 import javax.swing.JLabel; 22 23 24 import javax.swing.JOptionPane; 25 import javax.swing.JPanel; 26 import org.openstreetmap.josm.Main; 23 27 import org.openstreetmap.josm.actions.SplitWayAction; 24 28 import org.openstreetmap.josm.data.osm.Node; … … 30 34 import org.openstreetmap.josm.data.osm.Way; 31 35 import org.openstreetmap.josm.data.osm.WaySegment; 36 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 32 37 import org.openstreetmap.josm.gui.DefaultNameFormatter; 33 38 import org.openstreetmap.josm.gui.actionsupport.DeleteFromRelationConfirmationDialog; … … 35 40 import org.openstreetmap.josm.tools.CheckParameterUtil; 36 41 import org.openstreetmap.josm.tools.ImageProvider; 42 import org.openstreetmap.josm.tools.Utils; 37 43 38 44 /** … … 317 323 318 324 Set<OsmPrimitive> primitivesToDelete = new HashSet<OsmPrimitive>(selection); 325 326 Collection<Relation> relationsToDelete = Utils.filteredCollection(primitivesToDelete, Relation.class); 327 if(!relationsToDelete.isEmpty() && !silent && !confirmRelationDeletion(relationsToDelete)) { 328 return null; 329 } 330 319 331 Collection<Way> waysToBeChanged = new HashSet<Way>(); 320 332 … … 441 453 } 442 454 455 private static boolean confirmRelationDeletion(Collection<Relation> relations) { 456 String relationString = "<ul>"; 457 for(Relation r:relations) { 458 relationString += "<li>"+DefaultNameFormatter.getInstance().format(r) + "</li>"; 459 } 460 relationString += "</ul>"; 461 462 JPanel msg = new JPanel(new GridBagLayout()); 463 msg.add(new JLabel("<html>" + trn( 464 "You are about to delete {0} relation: {1}" 465 + "<br/>" 466 + "This step is rarely necessary and cannot be undone easily after being uploaded to the server." 467 + "<br/>" 468 + "Do you really want to delete?", 469 "You are about to delete {0} relations: {1}" 470 + "<br/>" 471 + "This step is rarely necessary and cannot be undone easily after being uploaded to the server." 472 + "<br/>" 473 + "Do you really want to delete?", 474 relations.size(), relations.size(), relationString) + "</html>")); 475 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 476 "delete_relations", 477 Main.parent, 478 msg, 479 tr("Delete relation?"), 480 JOptionPane.YES_NO_OPTION, 481 JOptionPane.QUESTION_MESSAGE, 482 JOptionPane.YES_OPTION); 483 return answer; 484 } 443 485 }
Note:
See TracChangeset
for help on using the changeset viewer.