2 * Copyright (C) 2011 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.view
.uses
.operation
;
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
;
17 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
18 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
19 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
20 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
22 import eu
.etaxonomy
.taxeditor
.editor
.UsageTermCollection
;
23 import eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
.operation
.CreateTaxonDescriptionOperation
;
24 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 * CreateTaxonUseOperation Class
30 * @created mar 13, 2012
33 public class CreateTaxonUseOperation
extends CreateTaxonDescriptionOperation
{
34 private TaxonDescription description
;
35 private Marker marker
;
38 * <p>Constructor for CreateTaxonUseOperation.</p>
40 * @param label a {@link java.lang.String} object.
41 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
42 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
43 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
45 public CreateTaxonUseOperation(String label
, IUndoContext undoContext
,
46 Taxon taxon
, IPostOperationEnabled postOperationEnabled
) {
47 this(label
, undoContext
, taxon
, postOperationEnabled
, false);
51 * <p>Constructor for CreateTaxonUseOperation.</p>
53 * @param label a {@link java.lang.String} object.
54 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
55 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
56 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
57 * @param isImageGallery a boolean.
59 public CreateTaxonUseOperation(String label
, IUndoContext undoContext
,
60 Taxon taxon
, IPostOperationEnabled postOperationEnabled
, boolean isImageGallery
) {
61 super(label
, undoContext
, taxon
, postOperationEnabled
);
65 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
69 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
70 throws ExecutionException
{
72 description
= TaxonDescription
.NewInstance(element
);
74 MarkerType useMarkerType
= (MarkerType
) CdmStore
.getService(ITermService
.class).find(UsageTermCollection
.uuidUseMarkerType
);
75 marker
= Marker
.NewInstance(useMarkerType
, true);
76 description
.addMarker(marker
);
79 return postExecute(description
);