diff --git a/src/org/openstreetmap/josm/command/DeleteCommand.java b/src/org/openstreetmap/josm/command/DeleteCommand.java
index aaf4744..ceb5e26 100644
|
a
|
b
|
|
| 1 | 1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others |
| 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; |
| 6 | 7 | import static org.openstreetmap.josm.tools.I18n.tr; |
| … |
… |
import java.util.Map.Entry;
|
| 20 | 21 | |
| 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; |
| 25 | 29 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| … |
… |
import org.openstreetmap.josm.data.osm.Relation;
|
| 29 | 33 | import org.openstreetmap.josm.data.osm.RelationToChildReference; |
| 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; |
| 34 | 39 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 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 | /** |
| 39 | 45 | * A command to delete a number of primitives from the dataset. |
| … |
… |
public class DeleteCommand extends Command {
|
| 316 | 322 | return null; |
| 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 | |
| 321 | 333 | if (alsoDeleteNodesInWay) { |
| … |
… |
public class DeleteCommand extends Command {
|
| 440 | 452 | area, primitives, ignore); |
| 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 | } |