- Timestamp:
- 2014-09-16T19:51:33+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r7434 r7546 78 78 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 79 79 import org.openstreetmap.josm.gui.tagging.PresetHandler; 80 import org.openstreetmap.josm.gui.tagging.TagEditorModel; 80 81 import org.openstreetmap.josm.gui.tagging.TagEditorPanel; 81 82 import org.openstreetmap.josm.gui.tagging.TaggingPreset; … … 738 739 } 739 740 740 public static Command addPrimitivesToRelation(final Relation orig, Collection<? extends OsmPrimitive> primitivesToAdd) throws IllegalArgumentException { 741 public static Command addPrimitivesToRelation(final Relation orig, Collection<? extends OsmPrimitive> primitivesToAdd) 742 throws IllegalArgumentException { 741 743 CheckParameterUtil.ensureParameterNotNull(orig, "orig"); 742 744 try { 743 final Collection<TaggingPreset> presets = TaggingPreset.getMatchingPresets(EnumSet.of(TaggingPresetType.RELATION), orig.getKeys(), false); 745 final Collection<TaggingPreset> presets = TaggingPreset.getMatchingPresets( 746 EnumSet.of(TaggingPresetType.RELATION), orig.getKeys(), false); 744 747 Relation relation = new Relation(orig); 745 748 boolean modified = false; … … 1370 1373 public void actionPerformed(ActionEvent e) { 1371 1374 memberTable.stopHighlighting(); 1372 if (!memberTableModel.hasSameMembersAs(getRelationSnapshot()) || tagEditorPanel.getModel().isDirty()) { 1375 TagEditorModel tagModel = tagEditorPanel.getModel(); 1376 Relation snapshot = getRelationSnapshot(); 1377 if ( (!memberTableModel.hasSameMembersAs(snapshot) || tagModel.isDirty()) 1378 && !(snapshot == null && tagModel.getTags().isEmpty())) { 1373 1379 //give the user a chance to save the changes 1374 1380 int ret = confirmClosingByCancel(); … … 1378 1384 if (getRelation() == null) { 1379 1385 applyNewRelation(); 1380 } else if (!memberTableModel.hasSameMembersAs(getRelationSnapshot()) 1381 || tagEditorPanel.getModel().isDirty()) { 1386 } else if (!memberTableModel.hasSameMembersAs(snapshot) || tagModel.isDirty()) { 1382 1387 if (isDirtyRelation()) { 1383 1388 if (confirmClosingBecauseOfDirtyState()) { … … 1393 1398 } 1394 1399 } 1395 } 1396 else if (ret == 2) //Cancel, continue editing 1400 } else if (ret == 2) //Cancel, continue editing 1397 1401 return; 1398 1402 //in case of "No, discard", there is no extra action to be performed here.
Note:
See TracChangeset
for help on using the changeset viewer.