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
.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
;
26 * CreateTaxonUseOperation Class
28 * @created mar 13, 2012
30 public class CreateTaxonUseOperation
extends CreateTaxonDescriptionOperation
{
31 private TaxonDescription description
;
32 private Marker marker
;
35 * <p>Constructor for CreateTaxonUseOperation.</p>
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.
42 public CreateTaxonUseOperation(String label
, IUndoContext undoContext
,
43 Taxon taxon
, IPostOperationEnabled postOperationEnabled
) {
44 this(label
, undoContext
, taxon
, postOperationEnabled
, false);
48 * <p>Constructor for CreateTaxonUseOperation.</p>
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.
56 public CreateTaxonUseOperation(String label
, IUndoContext undoContext
,
57 Taxon taxon
, IPostOperationEnabled postOperationEnabled
, boolean isImageGallery
) {
58 super(label
, undoContext
, taxon
, null, postOperationEnabled
);
64 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
65 throws ExecutionException
{
67 description
= TaxonDescription
.NewInstance(element
);
69 MarkerType useMarkerType
= UseObjectStore
.getUseMarkerType();
70 marker
= Marker
.NewInstance(useMarkerType
, true);
71 description
.addMarker(marker
);
74 return postExecute(description
);