1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.DataPoint;
\r
5 import tim.prune.data.Field;
\r
6 import tim.prune.data.TrackInfo;
\r
9 * Operation to undo a delete of a single point
\r
11 public class UndoDeletePoint implements UndoOperation
\r
13 private int _pointIndex = -1;
\r
14 private DataPoint _point = null;
\r
19 * @param inIndex index number of point within track
\r
20 * @param inPoint data point
\r
22 public UndoDeletePoint(int inIndex, DataPoint inPoint)
\r
24 _pointIndex = inIndex;
\r
30 * @return description of operation including point name if any
\r
32 public String getDescription()
\r
34 String desc = I18nManager.getText("undo.deletepoint");
\r
35 String pointName = _point.getFieldValue(Field.WAYPT_NAME);
\r
36 if (pointName != null && !pointName.equals(""))
\r
37 desc = desc + " " + pointName;
\r
43 * Perform the undo operation on the given Track
\r
44 * @param inTrack Track object on which to perform the operation
\r
46 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
48 // restore point into track
\r
49 if (!inTrackInfo.getTrack().insertPoint(_point, _pointIndex))
\r
51 throw new UndoException(getDescription());
\r