]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/undo/UndoReverseSection.java
73fe6923a2d834d96851f88c5748d28d52cc6d52
[GpsPrune.git] / tim / prune / undo / UndoReverseSection.java
1 package tim.prune.undo;
2
3 import tim.prune.I18nManager;
4 import tim.prune.data.TrackInfo;
5
6 /**
7  * Undo reversal of track section
8  */
9 public class UndoReverseSection implements UndoOperation
10 {
11         private int _startIndex, _endIndex;
12
13
14         /**
15          * Constructor
16          * @param inStart start index of section
17          * @param inEnd end index of section
18          */
19         public UndoReverseSection(int inStart, int inEnd)
20         {
21                 _startIndex = inStart;
22                 _endIndex = inEnd;
23         }
24
25
26         /**
27          * @return description of operation
28          */
29         public String getDescription()
30         {
31                 return I18nManager.getText("undo.reverse");
32         }
33
34
35         /**
36          * Perform the undo operation on the given Track
37          * @param inTrackInfo TrackInfo object on which to perform the operation
38          */
39         public void performUndo(TrackInfo inTrackInfo) throws UndoException
40         {
41                 if (!inTrackInfo.getTrack().reverseRange(_startIndex, _endIndex))
42                 {
43                         throw new UndoException(getDescription());
44                 }
45         }
46 }