--- /dev/null
+package tim.prune.undo;\r
+\r
+import tim.prune.I18nManager;\r
+import tim.prune.data.DataPoint;\r
+import tim.prune.data.Photo;\r
+import tim.prune.data.TrackInfo;\r
+\r
+/**\r
+ * Operation to undo the connection of a photo to a point\r
+ */\r
+public class UndoConnectPhoto implements UndoOperation\r
+{\r
+ private DataPoint _point = null;\r
+ private String _filename = null;\r
+\r
+\r
+ /**\r
+ * Constructor\r
+ * @param inPoint data point\r
+ * @param inFilename filename of photo\r
+ */\r
+ public UndoConnectPhoto(DataPoint inPoint, String inFilename)\r
+ {\r
+ _point = inPoint;\r
+ _filename = inFilename;\r
+ }\r
+\r
+\r
+ /**\r
+ * @return description of operation including photo filename\r
+ */\r
+ public String getDescription()\r
+ {\r
+ String desc = I18nManager.getText("undo.connectphoto") + " " + _filename;\r
+ return desc;\r
+ }\r
+\r
+\r
+ /**\r
+ * Perform the undo operation on the given Track\r
+ * @param inTrackInfo TrackInfo object on which to perform the operation\r
+ */\r
+ public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
+ {\r
+ // Disconnect again\r
+ Photo photo = _point.getPhoto();\r
+ if (photo != null)\r
+ {\r
+ _point.setPhoto(null);\r
+ photo.setDataPoint(null);\r
+ }\r
+ else\r
+ {\r
+ // throw exception if failed\r
+ throw new UndoException(getDescription());\r
+ }\r
+ }\r
+}
\ No newline at end of file