Changeset 1642 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2009-06-06T16:25:25+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/command
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java
r1622 r1642 25 25 */ 26 26 public class TagConflictResolveCommand extends Command { 27 27 28 28 /** my primitive (in the local dataset). merge decisions are applied to this 29 29 * primitive 30 30 */ 31 private OsmPrimitive my; 32 /** their primitive (in the server dataset) */ 33 private OsmPrimitive their; 34 31 private final OsmPrimitive my; 32 /** their primitive (in the server dataset) */ 33 private final OsmPrimitive their; 34 35 35 /** the list of merge decisions, represented as {@see TagMergeItem}s */ 36 private List<TagMergeItem> mergeItems; 37 36 private final List<TagMergeItem> mergeItems; 37 38 38 /** 39 39 * replies the number of decided conflicts 40 40 * 41 * @return the number of decided conflicts 41 * @return the number of decided conflicts 42 42 */ 43 43 public int getNumDecidedConflicts() { … … 45 45 for (TagMergeItem item: mergeItems) { 46 46 if (!item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) { 47 n++; 47 n++; 48 48 } 49 49 } 50 50 return n; 51 51 } 52 52 53 53 /** 54 54 * replies a (localized) display name for the type of an OSM primitive … … 63 63 return ""; 64 64 } 65 65 66 66 /** 67 * constructor 67 * constructor 68 68 * 69 69 * @param my my primitive 70 * @param their their primitive 70 * @param their their primitive 71 71 * @param mergeItems the list of merge decisions, represented as {@see TagMergeItem}s 72 72 */ … … 76 76 this.mergeItems = mergeItems; 77 77 } 78 79 78 79 80 80 @Override 81 public MutableTreeNode description() { 81 public MutableTreeNode description() { 82 82 return new DefaultMutableTreeNode( 83 new JLabel( 84 tr("Resolve {0} tag conflicts in {1} {2}",getNumDecidedConflicts(), getPrimitiveTypeAsString(my), my.id), 85 ImageProvider.get("data", "object"), 86 JLabel.HORIZONTAL 87 ) 88 ); 83 new JLabel( 84 tr("Resolve {0} tag conflicts in {1} {2}",getNumDecidedConflicts(), getPrimitiveTypeAsString(my), my.id), 85 ImageProvider.get("data", "object"), 86 JLabel.HORIZONTAL 87 ) 88 ); 89 89 } 90 90 … … 95 95 // 96 96 super.executeCommand(); 97 97 98 98 // apply the merge decisions to OSM primitive 'my' 99 99 // 100 100 for (TagMergeItem item: mergeItems) { 101 item.applyToMyPrimitive(my); 101 if (! item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) { 102 item.applyToMyPrimitive(my); 103 } 102 104 } 103 105 return true; … … 115 117 // 116 118 super.undoCommand(); 117 119 118 120 // restore a conflict if necessary 119 121 // … … 123 125 } 124 126 125 127 126 128 } -
trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
r1622 r1642 24 24 public class VersionConflictResolveCommand extends Command { 25 25 26 private OsmPrimitive my; 27 private OsmPrimitive their; 28 26 private final OsmPrimitive my; 27 private final OsmPrimitive their; 28 29 29 /** 30 * constructor 31 * @param my my primitive (i.e. the primitive from the local dataset) 32 * @param their their primitive (i.e. the primitive from the server) 30 * constructor 31 * @param my my primitive (i.e. the primitive from the local dataset) 32 * @param their their primitive (i.e. the primitive from the server) 33 33 */ 34 34 public VersionConflictResolveCommand(OsmPrimitive my, OsmPrimitive their) { 35 this.my = my; 36 this.their = their; 35 this.my = my; 36 this.their = their; 37 37 } 38 38 39 39 //FIXME copied from TagConflictResolveCommand -> refactor 40 40 /** … … 50 50 return ""; 51 51 } 52 52 53 53 @Override 54 54 public MutableTreeNode description() { 55 55 return new DefaultMutableTreeNode( 56 new JLabel( 57 tr("Resolve version conflicts for {0} {1}",getPrimitiveTypeAsString(my), my.id), 58 ImageProvider.get("data", "object"), 59 JLabel.HORIZONTAL 60 ) 61 56 new JLabel( 57 tr("Resolve version conflicts for {0} {1}",getPrimitiveTypeAsString(my), my.id), 58 ImageProvider.get("data", "object"), 59 JLabel.HORIZONTAL 60 ) 61 ); 62 62 } 63 63 … … 66 66 super.executeCommand(); 67 67 my.version = Math.max(my.version, their.version); 68 Main.map.conflictDialog. conflicts.remove(my);68 Main.map.conflictDialog.removeConflictForPrimitive(my); 69 69 return true; 70 70 } … … 79 79 public void undoCommand() { 80 80 super.undoCommand(); 81 81 82 82 // restore a conflict if necessary 83 83 // 84 84 if (!Main.map.conflictDialog.conflicts.containsKey(my)) { 85 Main.map.conflictDialog. conflicts.put(my,their);85 Main.map.conflictDialog.addConflict(my, their); 86 86 } 87 87 } 88 88 89 89 90 90 }
Note:
See TracChangeset
for help on using the changeset viewer.