diff --git a/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java b/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java index a4e19e2183c..01e46ce3621 100644 --- a/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java +++ b/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java @@ -155,10 +155,6 @@ public class GenericRelationEditor extends RelationEditor implements CommandQueu * Action for performing the {@link CancelAction} */ private final CancelAction cancelAction; - /** - * Action for performing the {@link DeleteCurrentRelationAction} - */ - private final DeleteCurrentRelationAction deleteAction; /** * A list of listeners that need to be notified on clipboard content changes. */ @@ -269,7 +265,7 @@ public Collection getSelection() { // Action for performing the {@link DuplicateRelationAction} final DuplicateRelationAction duplicateAction = new DuplicateRelationAction(actionAccess); // Action for performing the {@link DeleteCurrentRelationAction} - deleteAction = new DeleteCurrentRelationAction(actionAccess); + final DeleteCurrentRelationAction deleteAction = new DeleteCurrentRelationAction(actionAccess); this.memberTableModel.addTableModelListener(applyAction); this.tagEditorPanel.getModel().addTableModelListener(applyAction); @@ -409,7 +405,6 @@ protected static JToolBar buildToolBar(AbstractRelationEditorAction... actions) /** * builds the panel with the OK and the Cancel button * @param okAction OK action - * @param deleteAction Delete action * @param cancelAction Cancel action * * @return the panel with the OK and the Cancel button @@ -1081,7 +1076,6 @@ public AutoCompletingTextField getTextFieldRole() { @Override public void commandChanged(int queueSize, int redoSize) { - deleteAction.updateEnabledState(); Relation r = getRelation(); if (r != null && r.getDataSet() == null) { // see #19915 diff --git a/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java b/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java index a40072e6cfb..c195ca335f0 100644 --- a/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java +++ b/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java @@ -8,7 +8,10 @@ import org.openstreetmap.josm.actions.mapmode.DeleteAction; import org.openstreetmap.josm.data.osm.Relation; +import org.openstreetmap.josm.gui.MainApplication; import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor; +import org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager; +import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.tools.ImageProvider; /** @@ -35,13 +38,20 @@ public void actionPerformed(ActionEvent e) { Relation toDelete = getEditor().getRelation(); if (toDelete == null) return; + if (toDelete.isDeleted()) { + // see #23447 + OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer(); + if (layer != null) { + RelationDialogManager.getRelationDialogManager().close(layer, toDelete); + } + return; + } DeleteAction.deleteRelation(getLayer(), toDelete); } @Override - public void updateEnabledState() { - Relation r = getEditor().getRelation(); - setEnabled(r != null && !r.isDeleted()); + protected void updateEnabledState() { + setEnabled(getEditor().getRelationSnapshot() != null); } @Override