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
6 import tim.prune.function.edit.FieldEditList;
\r
9 * Operation to undo the edit of a single point
\r
11 public class UndoEditPoint implements UndoOperation
\r
13 private DataPoint _originalPoint = null;
\r
14 private FieldEditList _undoFieldList = null;
\r
19 * @param inPoint data point
\r
20 * @param inUndoFieldList FieldEditList for undo operation
\r
22 public UndoEditPoint(DataPoint inPoint, FieldEditList inUndoFieldList)
\r
24 _originalPoint = inPoint;
\r
25 _undoFieldList = inUndoFieldList;
\r
30 * @return description of operation including point name if any
\r
32 public String getDescription()
\r
34 String desc = I18nManager.getText("undo.editpoint");
\r
35 String newName = _undoFieldList.getEdit(0).getValue();
\r
36 String pointName = _originalPoint.getWaypointName();
\r
37 if (newName != null && !newName.equals(""))
\r
38 desc = desc + " " + newName;
\r
39 else if (pointName != null && !pointName.equals(""))
\r
40 desc = desc + " " + pointName;
\r
46 * Perform the undo operation on the given Track
\r
47 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
49 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
51 // Restore contents of point into track
\r
52 if (!inTrackInfo.getTrack().editPoint(_originalPoint, _undoFieldList, true))
\r
54 // throw exception if failed
\r
55 throw new UndoException(getDescription());
\r