--- /dev/null
+package tim.prune.undo;\r
+\r
+import tim.prune.I18nManager;\r
+import tim.prune.data.DataPoint;\r
+import tim.prune.data.Field;\r
+import tim.prune.data.TrackInfo;\r
+\r
+/**\r
+ * Operation to undo a delete of a single point\r
+ */\r
+public class UndoDeletePoint implements UndoOperation\r
+{\r
+ private int _pointIndex = -1;\r
+ private DataPoint _point = null;\r
+\r
+\r
+ /**\r
+ * Constructor\r
+ * @param inIndex index number of point within track\r
+ * @param inPoint data point\r
+ */\r
+ public UndoDeletePoint(int inIndex, DataPoint inPoint)\r
+ {\r
+ _pointIndex = inIndex;\r
+ _point = inPoint;\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.deletepoint");\r
+ String pointName = _point.getFieldValue(Field.WAYPT_NAME);\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 point into track\r
+ if (!inTrackInfo.getTrack().insertPoint(_point, _pointIndex))\r
+ {\r
+ throw new UndoException(getDescription());\r
+ }\r
+ }\r
+}
\ No newline at end of file