1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.AudioFile;
\r
5 import tim.prune.data.DataPoint;
\r
6 import tim.prune.data.Photo;
\r
7 import tim.prune.data.TrackInfo;
\r
10 * Operation to undo the disconnection of a photo or audio from a point
\r
12 public class UndoDisconnectMedia implements UndoOperation
\r
14 private DataPoint _point = null;
\r
15 private Photo _photo = null;
\r
16 private AudioFile _audio = null;
\r
17 private String _filename = null;
\r
22 * @param inPoint data point
\r
23 * @param inPhoto true if photo was disconnected
\r
24 * @param inAudio true if audio was disconnected
\r
25 * @param inFilename filename of photo / audio
\r
27 public UndoDisconnectMedia(DataPoint inPoint, boolean inPhoto, boolean inAudio, String inFilename)
\r
31 _photo = inPoint.getPhoto();
\r
34 _audio = inPoint.getAudio();
\r
36 _filename = inFilename;
\r
41 * @return description of operation including filename
\r
43 public String getDescription()
\r
45 return I18nManager.getText("undo.disconnect") + " " + _filename;
\r
50 * Perform the undo operation on the given Track
\r
51 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
53 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
56 if (_point != null && _photo != null)
\r
58 _point.setPhoto(_photo);
\r
59 _photo.setDataPoint(_point);
\r
61 else if (_point != null && _audio != null)
\r
63 _point.setAudio(_audio);
\r
64 _audio.setDataPoint(_point);
\r
67 // throw exception if failed
\r
68 throw new UndoException(getDescription());
\r
71 inTrackInfo.getSelection().clearAll();
\r