File: DisconnectPhotoFunction.java

package info (click to toggle)
gpsprune 13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,008 kB
  • sloc: java: 28,802; sh: 25; makefile: 17; python: 15
file content (47 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package tim.prune.function;

import tim.prune.App;
import tim.prune.DataSubscriber;
import tim.prune.GenericFunction;
import tim.prune.I18nManager;
import tim.prune.UpdateMessageBroker;
import tim.prune.data.DataPoint;
import tim.prune.data.Photo;
import tim.prune.undo.UndoDisconnectMedia;

/**
 * Function to disconnect the current photo from the current point
 */
public class DisconnectPhotoFunction extends GenericFunction
{
	/**
	 * Constructor
	 * @param inApp app object
	 */
	public DisconnectPhotoFunction(App inApp) {
		super(inApp);
	}

	/** @return name key */
	public String getNameKey() {
		return "function.disconnectfrompoint";
	}

	/**
	 * Perform the operation
	 */
	public void begin()
	{
		Photo photo = _app.getTrackInfo().getCurrentPhoto();
		if (photo != null && photo.getDataPoint() != null)
		{
			DataPoint point = photo.getDataPoint();
			UndoDisconnectMedia undo = new UndoDisconnectMedia(point, true, false, photo.getName());
			// disconnect
			photo.setDataPoint(null);
			point.setPhoto(null);
			UpdateMessageBroker.informSubscribers(DataSubscriber.SELECTION_CHANGED);
			_app.completeFunction(undo, I18nManager.getText("confirm.photo.disconnect"));
		}
	}
}