diff --git a/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java b/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java
index 08eea7019..31f6c6ade 100644
|
a
|
b
|
|
| 3 | 3 | |
| 4 | 4 | import static org.openstreetmap.josm.tools.I18n.tr; |
| 5 | 5 | |
| | 6 | import java.awt.GridBagLayout; |
| 6 | 7 | import java.awt.event.ActionEvent; |
| 7 | 8 | |
| | 9 | import javax.swing.JOptionPane; |
| | 10 | import javax.swing.JPanel; |
| | 11 | |
| | 12 | import org.openstreetmap.josm.data.osm.DefaultNameFormatter; |
| 8 | 13 | import org.openstreetmap.josm.data.osm.IRelation; |
| 9 | 14 | import org.openstreetmap.josm.data.osm.Relation; |
| | 15 | import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; |
| 10 | 16 | import org.openstreetmap.josm.gui.MainApplication; |
| 11 | 17 | import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; |
| | 18 | import org.openstreetmap.josm.gui.widgets.JMultilineLabel; |
| 12 | 19 | import org.openstreetmap.josm.tools.ImageProvider; |
| 13 | 20 | |
| 14 | 21 | /** |
| … |
… |
public DuplicateRelationAction() {
|
| 31 | 38 | * @param original The relation to duplicate |
| 32 | 39 | */ |
| 33 | 40 | public static void duplicateRelationAndLaunchEditor(Relation original) { |
| | 41 | if (!confirmRelationDuplicate(original)) { |
| | 42 | return; |
| | 43 | } |
| 34 | 44 | Relation copy = new Relation(original, true); |
| 35 | 45 | copy.setModified(true); |
| 36 | 46 | RelationEditor editor = RelationEditor.getEditor( |
| … |
… |
protected void updateEnabledState() {
|
| 61 | 71 | setEnabled(relations.size() == 1 |
| 62 | 72 | && isEditableRelation(relations.iterator().next())); |
| 63 | 73 | } |
| | 74 | |
| | 75 | private static boolean confirmRelationDuplicate(Relation relation) { |
| | 76 | JPanel msg = new JPanel(new GridBagLayout()); |
| | 77 | msg.add(new JMultilineLabel("<html>" + tr( |
| | 78 | "You are about to duplicate {0} relation: {1}" |
| | 79 | + "<br/>" |
| | 80 | + "This step is rarely necessary. Do you really want to duplicate?", |
| | 81 | 1, DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(relation)) |
| | 82 | + "</html>")); |
| | 83 | return ConditionalOptionPaneUtil.showConfirmationDialog( |
| | 84 | "delete_relations", |
| | 85 | MainApplication.getMainFrame(), |
| | 86 | msg, |
| | 87 | tr("Duplicate relation?"), |
| | 88 | JOptionPane.YES_NO_OPTION, |
| | 89 | JOptionPane.QUESTION_MESSAGE, |
| | 90 | JOptionPane.YES_OPTION); |
| | 91 | } |
| 64 | 92 | } |