- Timestamp:
- 2020-10-12T15:12:32+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r17140 r17172 51 51 import org.openstreetmap.josm.command.ChangeCommand; 52 52 import org.openstreetmap.josm.command.Command; 53 import org.openstreetmap.josm.data.UndoRedoHandler; 54 import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueListener; 53 55 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 54 56 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 115 117 * @since 343 116 118 */ 117 public class GenericRelationEditor extends RelationEditor {119 public class GenericRelationEditor extends RelationEditor implements CommandQueueListener { 118 120 /** the tag table and its model */ 119 121 private final TagEditorPanel tagEditorPanel; … … 310 312 memberTableModel.setSelectedMembers(selectedMembers); 311 313 HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/RelationEditor")); 314 UndoRedoHandler.getInstance().addCommandQueueListener(this); 312 315 } 313 316 … … 836 839 public void dispose() { 837 840 refreshAction.destroy(); 841 UndoRedoHandler.getInstance().removeCommandQueueListener(this); 842 setRelation(null); 838 843 super.dispose(); 839 844 } … … 1015 1020 1016 1021 } 1022 1023 @Override 1024 public void commandChanged(int queueSize, int redoSize) { 1025 Relation r = getRelation(); 1026 if (r != null && r.getDataSet() == null) { 1027 // see #19915 1028 setRelation(null); 1029 applyAction.updateEnabledState(); 1030 } 1031 } 1017 1032 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r17140 r17172 158 158 public void dispose() { 159 159 layer.setRecentRelation(relation); 160 setRelation(null);161 160 super.dispose(); 162 161 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java
r14030 r17172 35 35 36 36 @Override 37 p rotectedvoid updateEnabledState() {37 public void updateEnabledState() { 38 38 setEnabled(isEditorDirty()); 39 39 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java
r17063 r17172 68 68 @Override 69 69 public void updateEnabledState() { 70 Relation snapshot = editorAccess.getEditor().getRelationSnapshot(); 71 setEnabled((!getMemberTableModel().hasSameMembersAs(snapshot) || getTagModel().isDirty()) 72 && !(snapshot == null && getTagModel().getTags().isEmpty())); 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)); 78 return; 79 } 80 setEnabled(false); 73 81 } 74 82 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java
r17171 r17172 178 178 protected boolean isEditorDirty() { 179 179 Relation snapshot = editorAccess.getEditor().getRelationSnapshot(); 180 return (snapshot != null && !getMemberTableModel().hasSameMembersAs(snapshot)) || getTagModel().isDirty(); 180 return (snapshot != null && !getMemberTableModel().hasSameMembersAs(snapshot)) || getTagModel().isDirty() 181 || getEditor().getRelation() == null || getEditor().getRelation().getDataSet() == null; 181 182 } 182 183 }
Note:
See TracChangeset
for help on using the changeset viewer.