1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.DataPoint;
\r
5 import tim.prune.data.TrackInfo;
\r
8 * Operation to undo a delete of a single point
\r
10 public class UndoDeletePoint implements UndoOperation
\r
12 private int _pointIndex = -1;
\r
13 private DataPoint _point = null;
\r
18 * @param inIndex index number of point within track
\r
19 * @param inPoint data point
\r
21 public UndoDeletePoint(int inIndex, DataPoint inPoint)
\r
23 _pointIndex = inIndex;
\r
29 * @return description of operation including point name if any
\r
31 public String getDescription()
\r
33 String desc = I18nManager.getText("undo.deletepoint");
\r
34 String pointName = _point.getWaypointName();
\r
35 if (pointName != null && !pointName.equals(""))
\r
36 desc = desc + " " + pointName;
\r
42 * Perform the undo operation on the given Track
\r
43 * @param inTrack Track object on which to perform the operation
\r
45 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
47 // restore point into track
\r
48 if (!inTrackInfo.getTrack().insertPoint(_point, _pointIndex))
\r
50 throw new UndoException(getDescription());
\r
52 // TODO: Reinsert photo into list if necessary
\r