Changeset 19398 in josm
- Timestamp:
- 2025-05-06T17:25:21+02:00 (7 days ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r18794 r19398 323 323 324 324 /** 325 * Returns the list of conflicts involving nodes.326 * @return The list of conflicts involving nodes.325 * Returns the list of conflicts involving ways. 326 * @return The list of conflicts involving ways. 327 327 * @since 6555 328 328 */ … … 332 332 333 333 /** 334 * Returns the list of conflicts involving nodes.335 * @return The list of conflicts involving nodes.334 * Returns the list of conflicts involving relations. 335 * @return The list of conflicts involving relations. 336 336 * @since 6555 337 337 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r19397 r19398 65 65 import org.openstreetmap.josm.gui.MainApplication; 66 66 import org.openstreetmap.josm.gui.MainMenu; 67 import org.openstreetmap.josm.gui.Notification; 67 68 import org.openstreetmap.josm.gui.ScrollViewport; 68 69 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; … … 1062 1063 public void commandChanged(int queueSize, int redoSize) { 1063 1064 Relation r = getRelation(); 1064 if (r != null && r.getDataSet() == null) { 1065 // see #19915 1066 setRelation(null); 1067 applyAction.updateEnabledState(); 1068 } 1065 if (r != null) { 1066 if (r.getDataSet() == null) { 1067 // see #19915 1068 setRelation(null); 1069 applyAction.updateEnabledState(); 1070 } else if (isDirtyRelation()) { 1071 if (!isDirtyEditor()) { 1072 reloadDataFromRelation(); 1073 } else { 1074 new Notification(tr("Relation modified outside of relation editor with pending changes. Conflict resolution required.")) 1075 .setIcon(JOptionPane.WARNING_MESSAGE).show(); 1076 } 1077 } 1078 } 1079 } 1080 1081 @Override 1082 public boolean isDirtyEditor() { 1083 Relation snapshot = getRelationSnapshot(); 1084 Relation relation = getRelation(); 1085 return (snapshot != null && !memberTableModel.hasSameMembersAs(snapshot)) || 1086 tagEditorPanel.getModel().isDirty() || relation == null || relation.getDataSet() == null; 1069 1087 } 1070 1088 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/IRelationEditor.java
r10113 r19398 40 40 * @return true if the currently edited relation has been changed elsewhere. 41 41 */ 42 boolean isDirtyRelation(); 42 default boolean isDirtyRelation() { 43 return isDirtyRelation(false); 44 } 45 46 /** 47 * Replies true if the currently edited relation has been changed elsewhere. 48 * 49 * In this case a relation editor can't apply updates to the relation directly. Rather, 50 * it has to create a conflict. 51 * 52 * @param ignoreUninterestingTags whether to ignore uninteresting tag changes 53 * @return true if the currently edited relation has been changed elsewhere. 54 * @since xxx 55 */ 56 boolean isDirtyRelation(boolean ignoreUninterestingTags); 57 58 /** 59 * Replies true if the relation has been changed in the editor (but not yet applied). 60 * 61 * Reloading data from the relation would cause the pending changes to be lost. 62 * 63 * @return true if the currently edited relation has been changed in the editor. 64 * @since xxx 65 */ 66 boolean isDirtyEditor(); 43 67 44 68 /** -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r17358 r19398 148 148 @Override 149 149 public final boolean isDirtyRelation() { 150 return !relation.hasEqualSemanticAttributes(relationSnapshot); 150 return isDirtyRelation(false); 151 } 152 153 @Override 154 public final boolean isDirtyRelation(boolean ignoreUninterestingTags) { 155 if (relation != null && relation.getDataSet() == null && 156 relationSnapshot != null && relationSnapshot.getDataSet() == null) { 157 return false; 158 } 159 160 return !relation.hasEqualSemanticAttributes(relationSnapshot, ignoreUninterestingTags); 151 161 } 152 162 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java
r17444 r19398 68 68 @Override 69 69 public void updateEnabledState() { 70 Relation snapshot = getEditor().getRelationSnapshot(); 71 Relation relation = getEditor().getRelation(); 72 if (relation != null && relation.getDataSet() == null) 73 relation = null; // see #19915 74 if (relation != null && snapshot != null && snapshot.getDataSet() == null) { 75 // relation was changed outside of the editor 76 // either it was modified or deleted or changed by an undo 77 setEnabled(!snapshot.hasEqualSemanticAttributes(relation, false /* don't ignore uninteresting keys */)); 78 return; 79 } 80 setEnabled(false); 70 setEnabled(getEditor().isDirtyRelation()); 81 71 } 82 72 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java
r18413 r19398 193 193 194 194 protected boolean isEditorDirty() { 195 Relation snapshot = editorAccess.getEditor().getRelationSnapshot(); 196 return (snapshot != null && !getMemberTableModel().hasSameMembersAs(snapshot)) || getTagModel().isDirty() 197 || getEditor().getRelation() == null || getEditor().getRelation().getDataSet() == null; 195 return editorAccess.getEditor().isDirtyEditor(); 198 196 } 199 197 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java
r19050 r19398 91 91 @Override 92 92 public boolean isDirtyRelation() { 93 return false; 94 } 95 96 @Override 97 public boolean isDirtyRelation(boolean ignoreUninterestingTags) { 98 return false; 99 } 100 101 @Override 102 public boolean isDirtyEditor() { 93 103 return false; 94 104 }
Note:
See TracChangeset
for help on using the changeset viewer.