--- /dev/null
+package tim.prune.undo;\r
+\r
+import tim.prune.I18nManager;\r
+import tim.prune.data.DataPoint;\r
+import tim.prune.data.TrackInfo;\r
+import tim.prune.edit.FieldEditList;\r
+\r
+/**\r
+ * Operation to undo the edit of a single point\r
+ */\r
+public class UndoEditPoint implements UndoOperation\r
+{\r
+ private DataPoint _originalPoint = null;\r
+ private FieldEditList _undoFieldList = null;\r
+\r
+\r
+ /**\r
+ * Constructor\r
+ * @param inPoint data point\r
+ * @param inUndoFieldList FieldEditList for undo operation\r
+ */\r
+ public UndoEditPoint(DataPoint inPoint, FieldEditList inUndoFieldList)\r
+ {\r
+ _originalPoint = inPoint;\r
+ _undoFieldList = inUndoFieldList;\r
+ }\r
+\r
+\r
+ /**\r
+ * @return description of operation including point name if any\r
+ */\r
+ public String getDescription()\r
+ {\r
+ String desc = I18nManager.getText("undo.editpoint");\r
+ String pointName = _originalPoint.getWaypointName();\r
+ if (pointName != null && !pointName.equals(""))\r
+ desc = desc + " " + pointName;\r
+ return desc;\r
+ }\r
+\r
+\r
+ /**\r
+ * Perform the undo operation on the given Track\r
+ * @param inTrack Track object on which to perform the operation\r
+ */\r
+ public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
+ {\r
+ // Restore contents of point into track\r
+ if (!inTrackInfo.getTrack().editPoint(_originalPoint, _undoFieldList))\r
+ {\r
+ // throw exception if failed\r
+ throw new UndoException(getDescription());\r
+ }\r
+ // TODO: Deal with photo if necessary\r
+ }\r
+}
\ No newline at end of file