Revision e6a01da7
Added by Alex Theys about 12 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.HashSet; |
4 | 4 |
import java.util.Set; |
5 |
import java.util.UUID; |
|
5 | 6 |
|
6 | 7 |
import org.eclipse.core.commands.ExecutionException; |
7 | 8 |
import org.eclipse.core.commands.operations.IUndoContext; |
... | ... | |
9 | 10 |
import org.eclipse.core.runtime.IProgressMonitor; |
10 | 11 |
import org.eclipse.core.runtime.IStatus; |
11 | 12 |
|
13 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
12 | 14 |
import eu.etaxonomy.cdm.model.common.Marker; |
13 | 15 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
14 | 16 |
import eu.etaxonomy.cdm.model.description.Feature; |
... | ... | |
29 | 31 |
*/ |
30 | 32 |
public class CreateTaxonUseOperation extends AbstractPostOperation { |
31 | 33 |
private TaxonDescription description; |
32 |
private boolean isImageGallery; |
|
33 |
private Set<MarkerType> markerTypes = new HashSet<MarkerType>(); |
|
34 | 34 |
private Marker marker; |
35 | 35 |
|
36 | 36 |
/** |
... | ... | |
58 | 58 |
public CreateTaxonUseOperation(String label, IUndoContext undoContext, |
59 | 59 |
Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) { |
60 | 60 |
super(label, undoContext, taxon, postOperationEnabled); |
61 |
this.isImageGallery = isImageGallery; |
|
62 | 61 |
} |
63 | 62 |
|
64 | 63 |
/* (non-Javadoc) |
... | ... | |
71 | 70 |
|
72 | 71 |
description = TaxonDescription.NewInstance(taxon); |
73 | 72 |
monitor.worked(20); |
74 |
//this.markerTypes.addAll(CdmStore.getTermManager().getPreferredMarkerTypes()); |
|
75 |
this.markerTypes.addAll(CdmStore.getTermManager().getPreferredTerms(MarkerType.class)); |
|
76 |
for (MarkerType markerType : markerTypes) { |
|
77 |
if (markerType.getTitleCache().equals("use")) { |
|
78 |
marker = Marker.NewInstance(markerType, true); |
|
79 |
description.addMarker(marker); |
|
80 |
} |
|
81 |
} |
|
82 |
if(isImageGallery){ |
|
83 |
description.setImageGallery(isImageGallery); |
|
84 |
// add the description element to hold the media elements for this image gallery |
|
85 |
TextData element = TextData.NewInstance(Feature.IMAGE()); |
|
86 |
element.addMedia(Media.NewInstance()); |
|
87 |
description.addElement(element); |
|
88 |
} |
|
73 |
MarkerType useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039")); |
|
74 |
marker = Marker.NewInstance(useMarkerType, true); |
|
75 |
description.addMarker(marker); |
|
89 | 76 |
monitor.worked(40); |
90 | 77 |
|
91 | 78 |
return postExecute(description); |
Also available in: Unified diff
AT: committing latest changes to the Tax Editor after a first round of Code review