|
62 | 62 | import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
|
63 | 63 | import org.openstreetmap.josm.gui.MainApplication;
|
64 | 64 | import org.openstreetmap.josm.gui.MainMenu;
|
| 65 | +import org.openstreetmap.josm.gui.Notification; |
65 | 66 | import org.openstreetmap.josm.gui.ScrollViewport;
|
66 | 67 | import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
|
67 | 68 | import org.openstreetmap.josm.gui.dialogs.relation.actions.AbstractRelationEditorAction;
|
@@ -1048,10 +1049,27 @@ public AutoCompletingTextField getTextFieldRole() {
|
1048 | 1049 | @Override
|
1049 | 1050 | public void commandChanged(int queueSize, int redoSize) {
|
1050 | 1051 | Relation r = getRelation();
|
1051 |
| - if (r != null && r.getDataSet() == null) { |
1052 |
| - // see #19915 |
1053 |
| - setRelation(null); |
1054 |
| - applyAction.updateEnabledState(); |
| 1052 | + if (r != null) { |
| 1053 | + if (r.getDataSet() == null) { |
| 1054 | + // see #19915 |
| 1055 | + setRelation(null); |
| 1056 | + applyAction.updateEnabledState(); |
| 1057 | + } else if (isDirtyRelation()) { |
| 1058 | + if (!isDirtyEditor()) { |
| 1059 | + reloadDataFromRelation(); |
| 1060 | + } else { |
| 1061 | + new Notification(tr("Relation modified outside of relation editor with pending changes. Conflict resolution required.")) |
| 1062 | + .setIcon(JOptionPane.WARNING_MESSAGE).show(); |
| 1063 | + } |
| 1064 | + } |
1055 | 1065 | }
|
1056 | 1066 | }
|
| 1067 | + |
| 1068 | + @Override |
| 1069 | + public boolean isDirtyEditor() { |
| 1070 | + Relation snapshot = getRelationSnapshot(); |
| 1071 | + Relation relation = getRelation(); |
| 1072 | + return (snapshot != null && !memberTableModel.hasSameMembersAs(snapshot)) || |
| 1073 | + tagEditorPanel.getModel().isDirty() || relation == null || relation.getDataSet() == null; |
| 1074 | + } |
1057 | 1075 | }
|
0 commit comments