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 java
.util
.UUID
;
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
;
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
.UsageTermCollection
;
25 import eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
.operation
.CreateTaxonDescriptionOperation
;
26 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
27 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 * CreateTaxonUseOperation Class
32 * @created mar 13, 2012
35 public class CreateTaxonUseOperation
extends CreateTaxonDescriptionOperation
{
36 private TaxonDescription description
;
37 private Marker marker
;
40 * <p>Constructor for CreateTaxonUseOperation.</p>
42 * @param label a {@link java.lang.String} object.
43 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
44 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
45 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
47 public CreateTaxonUseOperation(String label
, IUndoContext undoContext
,
48 Taxon taxon
, IPostOperationEnabled postOperationEnabled
) {
49 this(label
, undoContext
, taxon
, postOperationEnabled
, false);
53 * <p>Constructor for CreateTaxonUseOperation.</p>
55 * @param label a {@link java.lang.String} object.
56 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
57 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
58 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
59 * @param isImageGallery a boolean.
61 public CreateTaxonUseOperation(String label
, IUndoContext undoContext
,
62 Taxon taxon
, IPostOperationEnabled postOperationEnabled
, boolean isImageGallery
) {
63 super(label
, undoContext
, taxon
, postOperationEnabled
);
67 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
71 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
72 throws ExecutionException
{
74 description
= TaxonDescription
.NewInstance(taxon
);
76 MarkerType useMarkerType
= (MarkerType
) CdmStore
.getService(ITermService
.class).find(UsageTermCollection
.uuidUseMarkerType
);
77 marker
= Marker
.NewInstance(useMarkerType
, true);
78 description
.addMarker(marker
);
81 return postExecute(description
);