Index: applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java
===================================================================
--- applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java	(revision 18398)
+++ applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java	(revision 18399)
@@ -24,4 +24,6 @@
 import java.awt.event.WindowEvent;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
 import java.util.regex.Pattern;
 
@@ -40,4 +42,9 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.command.AddCommand;
+import org.openstreetmap.josm.command.ChangeCommand;
+import org.openstreetmap.josm.command.ChangePropertyCommand;
+import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -92,4 +99,7 @@
 	private JComboBox addrInterpolationList = null;
 
+	// For tracking edit changes as group for undo
+	private Collection<Command> commandGroup = null;
+	private Relation editedRelation = null;
 
 	public AddrInterpolationDialog(String name) {
@@ -744,19 +754,21 @@
 
 		// Entries are valid ... save in map
+
+		commandGroup = new LinkedList<Command>();
+
 		String streetName = selectedStreet.get("name");
 
 		if (addrInterpolationWay != null) {
-			addrInterpolationWay.setModified(true);
 
 			Node firstNode = addrInterpolationWay.getNode(0);
 			Node lastNode = addrInterpolationWay.getNode(addrInterpolationWay.getNodesCount()-1);
 
-			addrInterpolationWay.put("addr:interpolation", selectedMethod);
-			firstNode.put("addr:housenumber", startValueString);
-			lastNode.put("addr:housenumber", endValueString);
+			commandGroup.add(new ChangePropertyCommand(addrInterpolationWay, "addr:interpolation", selectedMethod));
+			commandGroup.add(new ChangePropertyCommand(firstNode, "addr:housenumber", startValueString));
+			commandGroup.add(new ChangePropertyCommand(lastNode, "addr:housenumber", endValueString));
 			if (streetNameButton.isSelected()) {
 
-				firstNode.put("addr:street", streetName);
-				lastNode.put("addr:street", streetName);
+				commandGroup.add(new ChangePropertyCommand(firstNode, "addr:street", streetName));
+				commandGroup.add(new ChangePropertyCommand(lastNode, "addr:street", streetName));
 
 			}
@@ -779,7 +791,8 @@
 			if (associatedStreetRelation == null) {
 				CreateRelation(streetName);
-				relationChanged = true;
-			}
-
+				// relationChanged = true;   (not changed since it was created)
+			}
+			// Make any additional changes only to the copy
+			editedRelation = new Relation(associatedStreetRelation);
 
 			if (addrInterpolationWay != null) {
@@ -793,6 +806,4 @@
 		for (Node node : houseNumberNodes) {
 
-			node.setModified(true); // Trigger re-upload in case there is a change
-
 			if (streetRelationButton.isSelected()) {
 				AddToRelation(associatedStreetRelation, node, "house");
@@ -800,28 +811,26 @@
 			if ((city != null) || (streetNameButton.isSelected()) ) {
 				// Include street unconditionally if adding nodes only or city name specified
-				node.put("addr:street", streetName);
+				commandGroup.add(new ChangePropertyCommand(node, "addr:street", streetName));
 			}
 			// Set or remove remaining optional fields
-			node.put("addr:city", city);
-			node.put("addr:state", state);
-			node.put("addr:postcode", postCode);
-			node.put("addr:country", country);
-			node.put("addr:full", fullAddress);
+			commandGroup.add(new ChangePropertyCommand(node, "addr:city", city));
+			commandGroup.add(new ChangePropertyCommand(node, "addr:state", state));
+			commandGroup.add(new ChangePropertyCommand(node, "addr:postcode", postCode));
+			commandGroup.add(new ChangePropertyCommand(node, "addr:country", country));
+			commandGroup.add(new ChangePropertyCommand(node, "addr:full", fullAddress));
 		}
 
 		if (relationChanged) {
-			associatedStreetRelation.setModified(true);
-
-			// Redraw relation list dialog
-			Main.main.getEditLayer().fireDataChange();
-		}
-
-
-		Main.map.mapView.repaint();
+			commandGroup.add(new ChangeCommand(associatedStreetRelation, editedRelation));
+		}
+
+
+		Main.main.undoRedo.add(new SequenceCommand(tr("Address Interpolation"), commandGroup));
+		Main.map.repaint();
 
 		return true;
 	}
 
-	// Create Associated Street relation, add street, and add to map
+	// Create Associated Street relation, add street, and add to list of commands to perform
 	private void CreateRelation(String streetName) {
 		associatedStreetRelation = new Relation();
@@ -830,5 +839,5 @@
 		RelationMember newStreetMember = new RelationMember("street", selectedStreet);
 		associatedStreetRelation.addMember(newStreetMember);
-		Main.main.getCurrentDataSet().addPrimitive(associatedStreetRelation);
+		commandGroup.add(new AddCommand(associatedStreetRelation));
 	}
 
@@ -863,5 +872,6 @@
 		if (!isFound) {
 			RelationMember newMember = new RelationMember(role, testMember);
-			associatedStreetRelation.addMember(newMember);
+			editedRelation.addMember(newMember);
+
 			relationChanged = true;
 		}
