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
|
*/
|
30
|
public class CreateTaxonUseOperation extends CreateTaxonDescriptionOperation {
|
31
|
private TaxonDescription description;
|
32
|
private Marker marker;
|
33
|
|
34
|
/**
|
35
|
* <p>Constructor for CreateTaxonUseOperation.</p>
|
36
|
*
|
37
|
* @param label a {@link java.lang.String} object.
|
38
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
39
|
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
|
40
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
41
|
*/
|
42
|
public CreateTaxonUseOperation(String label, IUndoContext undoContext,
|
43
|
Taxon taxon, IPostOperationEnabled postOperationEnabled) {
|
44
|
this(label, undoContext, taxon, postOperationEnabled, false);
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* <p>Constructor for CreateTaxonUseOperation.</p>
|
49
|
*
|
50
|
* @param label a {@link java.lang.String} object.
|
51
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
52
|
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
|
53
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
54
|
* @param isImageGallery a boolean.
|
55
|
*/
|
56
|
public CreateTaxonUseOperation(String label, IUndoContext undoContext,
|
57
|
Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
|
58
|
super(label, undoContext, taxon, postOperationEnabled);
|
59
|
}
|
60
|
|
61
|
|
62
|
/** {@inheritDoc} */
|
63
|
@Override
|
64
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
65
|
throws ExecutionException {
|
66
|
|
67
|
description = TaxonDescription.NewInstance(element);
|
68
|
monitor.worked(20);
|
69
|
MarkerType useMarkerType = UseObjectStore.getUseMarkerType();
|
70
|
marker = Marker.NewInstance(useMarkerType, true);
|
71
|
description.addMarker(marker);
|
72
|
monitor.worked(40);
|
73
|
|
74
|
return postExecute(description);
|
75
|
}
|
76
|
}
|
77
|
|