1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.DataPoint;
\r
5 import tim.prune.data.Track;
\r
6 import tim.prune.data.TrackInfo;
\r
9 * Operation to undo a track compression
\r
11 public class UndoCompress implements UndoOperation
\r
13 private DataPoint[] _contents = null;
\r
14 protected int _numPointsDeleted = -1;
\r
19 * @param inTrack track contents to copy
\r
21 public UndoCompress(Track inTrack)
\r
23 _contents = inTrack.cloneContents();
\r
28 * Set the number of points deleted
\r
29 * (only known after attempted compression)
\r
30 * @param inNum number of points deleted
\r
32 public void setNumPointsDeleted(int inNum)
\r
34 _numPointsDeleted = inNum;
\r
39 * @return description of operation including parameters
\r
41 public String getDescription()
\r
43 String desc = I18nManager.getText("undo.compress");
\r
44 if (_numPointsDeleted > 0)
\r
45 desc = desc + " (" + _numPointsDeleted + ")";
\r
51 * Perform the undo operation on the given Track
\r
52 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
54 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
56 // restore track to previous values
\r
57 inTrackInfo.getTrack().replaceContents(_contents);
\r
59 inTrackInfo.getSelection().clearAll();
\r