Project

General

Profile

Download (2.88 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2011 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.editor.view.uses.operation;
10

    
11
import org.eclipse.core.commands.ExecutionException;
12
import org.eclipse.core.commands.operations.IUndoContext;
13
import org.eclipse.core.runtime.IAdaptable;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IStatus;
16

    
17
import eu.etaxonomy.cdm.model.common.Marker;
18
import eu.etaxonomy.cdm.model.common.MarkerType;
19
import eu.etaxonomy.cdm.model.description.TaxonDescription;
20
import eu.etaxonomy.cdm.model.taxon.Taxon;
21
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
22
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
23
import eu.etaxonomy.taxeditor.store.UseObjectStore;
24

    
25
/**
26
 * CreateTaxonUseOperation Class
27
 * @author a.theys
28
 * @created mar 13, 2012
29
 * @version 1.0
30
 */
31
public class CreateTaxonUseOperation extends CreateTaxonDescriptionOperation {
32
	private TaxonDescription description;
33
	private Marker marker;
34

    
35
	/**
36
	 * <p>Constructor for CreateTaxonUseOperation.</p>
37
	 *
38
	 * @param label a {@link java.lang.String} object.
39
	 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
40
	 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
41
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
42
	 */
43
	public CreateTaxonUseOperation(String label, IUndoContext undoContext,
44
			Taxon taxon, IPostOperationEnabled postOperationEnabled) {
45
		this(label, undoContext, taxon, postOperationEnabled, false);
46
	}
47

    
48
	/**
49
	 * <p>Constructor for CreateTaxonUseOperation.</p>
50
	 *
51
	 * @param label a {@link java.lang.String} object.
52
	 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
53
	 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
54
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
55
	 * @param isImageGallery a boolean.
56
	 */
57
	public CreateTaxonUseOperation(String label, IUndoContext undoContext,
58
			Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
59
		super(label, undoContext, taxon, postOperationEnabled);
60
	}
61

    
62

    
63
	/** {@inheritDoc} */
64
	@Override
65
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
66
			throws ExecutionException {
67

    
68
		description = TaxonDescription.NewInstance(element);
69
		monitor.worked(20);
70
		MarkerType useMarkerType = UseObjectStore.getUseMarkerType();
71
		marker = Marker.NewInstance(useMarkerType, true);
72
		description.addMarker(marker);
73
		monitor.worked(40);
74

    
75
		return postExecute(description);
76
	}
77
}
78

    
(1-1/3)