Revision 7a0547ca
Added by Patrick Plitzner over 10 years ago
- enabled DescriptiveView (Factual Data) to show descriptions of SpecimenOrObservationBase
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
17 | 17 |
|
18 | 18 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
19 | 19 |
import eu.etaxonomy.cdm.model.description.CommonTaxonName; |
20 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
|
20 | 21 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
21 | 22 |
import eu.etaxonomy.cdm.model.description.Distribution; |
22 | 23 |
import eu.etaxonomy.cdm.model.description.Feature; |
23 | 24 |
import eu.etaxonomy.cdm.model.description.IndividualsAssociation; |
24 | 25 |
import eu.etaxonomy.cdm.model.description.QuantitativeData; |
25 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
26 | 26 |
import eu.etaxonomy.cdm.model.description.TaxonInteraction; |
27 | 27 |
import eu.etaxonomy.cdm.model.description.TextData; |
28 | 28 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
38 | 38 |
* @version 1.0 |
39 | 39 |
*/ |
40 | 40 |
public class CreateDescriptionElementOperation extends AbstractPostOperation { |
41 |
|
|
41 |
|
|
42 | 42 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.descripti"{trunked}</code> */ |
43 | 43 |
public static final String ID = "eu.etaxonomy.taxeditor.editor.description.createDescriptionElement"; |
44 |
|
|
45 |
private TaxonDescription description;
|
|
46 |
private Feature feature; |
|
44 |
|
|
45 |
private final DescriptionBase<?> description;
|
|
46 |
private final Feature feature;
|
|
47 | 47 |
private DescriptionElementBase element; |
48 | 48 |
|
49 | 49 |
/** |
... | ... | |
52 | 52 |
* @param label a {@link java.lang.String} object. |
53 | 53 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
54 | 54 |
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
55 |
* @param description a {@link eu.etaxonomy.cdm.model.description.TaxonDescription} object.
|
|
55 |
* @param description a {@link DescriptionBase} object.
|
|
56 | 56 |
* @param feature a {@link eu.etaxonomy.cdm.model.description.Feature} object. |
57 | 57 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
58 | 58 |
*/ |
59 | 59 |
public CreateDescriptionElementOperation(String label, IUndoContext undoContext, |
60 |
Taxon taxon, TaxonDescription description, Feature feature, IPostOperationEnabled postOperationEnabled) {
|
|
61 |
super(label, undoContext, taxon, postOperationEnabled);
|
|
62 |
|
|
60 |
DescriptionBase<?> description, Feature feature, IPostOperationEnabled postOperationEnabled) {
|
|
61 |
super(label, undoContext, (Taxon)null, postOperationEnabled);
|
|
62 |
|
|
63 | 63 |
this.description = description; |
64 | 64 |
this.feature = feature; |
65 | 65 |
} |
... | ... | |
69 | 69 |
* |
70 | 70 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
71 | 71 |
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
72 |
* @param description a {@link eu.etaxonomy.cdm.model.description.TaxonDescription} object.
|
|
72 |
* @param description a {@link DescriptionBase} object.
|
|
73 | 73 |
* @param feature a {@link eu.etaxonomy.cdm.model.description.Feature} object. |
74 | 74 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object. |
75 | 75 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
76 | 76 |
* @param label a {@link java.lang.String} object. |
77 | 77 |
*/ |
78 | 78 |
public CreateDescriptionElementOperation(String label, |
79 |
IUndoContext undoContext, Taxon taxon, |
|
80 |
TaxonDescription description, Feature feature, |
|
79 |
IUndoContext undoContext, DescriptionBase<?> description, Feature feature, |
|
81 | 80 |
DescriptionElementBase element, IPostOperationEnabled postOperationEnabled) { |
82 |
this(label, undoContext, taxon, description, feature, postOperationEnabled);
|
|
83 |
|
|
81 |
this(label, undoContext, description, feature, postOperationEnabled); |
|
82 |
|
|
84 | 83 |
this.element = element; |
85 | 84 |
} |
86 | 85 |
|
... | ... | |
96 | 95 |
if (element == null) { |
97 | 96 |
if (feature.isSupportsCommonTaxonName()) { |
98 | 97 |
element = CommonTaxonName.NewInstance("", null); |
99 |
}
|
|
98 |
} |
|
100 | 99 |
else if (feature.isSupportsDistribution()) { |
101 | 100 |
element = Distribution.NewInstance(); |
102 |
}
|
|
101 |
} |
|
103 | 102 |
else if(feature.isSupportsTaxonInteraction()){ |
104 | 103 |
element = TaxonInteraction.NewInstance(); |
105 | 104 |
} |
... | ... | |
131 | 130 |
@Override |
132 | 131 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
133 | 132 |
throws ExecutionException { |
134 |
|
|
133 |
|
|
135 | 134 |
description.addElement(element); |
136 |
|
|
135 |
|
|
137 | 136 |
return postExecute(element); |
138 | 137 |
} |
139 | 138 |
|
... | ... | |
144 | 143 |
@Override |
145 | 144 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
146 | 145 |
throws ExecutionException { |
147 |
|
|
146 |
|
|
148 | 147 |
description.removeElement(element); |
149 |
|
|
148 |
|
|
150 | 149 |
return postExecute(null); |
151 | 150 |
} |
152 | 151 |
} |
Also available in: Unified diff