Project

General

Profile

Download (3.21 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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 java.util.UUID;
12

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

    
19
import eu.etaxonomy.cdm.api.service.ITermService;
20
import eu.etaxonomy.cdm.model.common.Marker;
21
import eu.etaxonomy.cdm.model.common.MarkerType;
22
import eu.etaxonomy.cdm.model.description.TaxonDescription;
23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
25
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
26
import eu.etaxonomy.taxeditor.store.CdmStore;
27

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

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

    
51
	/**
52
	 * <p>Constructor for CreateTaxonUseOperation.</p>
53
	 *
54
	 * @param label a {@link java.lang.String} object.
55
	 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
56
	 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
57
	 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
58
	 * @param isImageGallery a boolean.
59
	 */
60
	public CreateTaxonUseOperation(String label, IUndoContext undoContext,
61
			Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
62
		super(label, undoContext, taxon, postOperationEnabled);
63
	}
64
	
65
	/* (non-Javadoc)
66
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
67
	 */
68
	/** {@inheritDoc} */
69
	@Override
70
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
71
			throws ExecutionException {
72
		
73
		description = TaxonDescription.NewInstance(taxon);
74
		monitor.worked(20);
75
		MarkerType useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
76
		marker = Marker.NewInstance(useMarkerType, true);
77
		description.addMarker(marker);
78
		monitor.worked(40);
79

    
80
		return postExecute(description);
81
	}
82
}
83

    
(1-1/3)