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
.view
.e4
.details
;
11 import java
.util
.Collection
;
12 import java
.util
.EnumSet
;
13 import java
.util
.HashSet
;
16 import javax
.inject
.Inject
;
18 import org
.eclipse
.e4
.core
.di
.annotations
.Optional
;
19 import org
.eclipse
.e4
.ui
.di
.UIEventTopic
;
20 import org
.eclipse
.jface
.viewers
.ISelection
;
21 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
22 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
23 import org
.eclipse
.jface
.viewers
.TreeNode
;
24 import org
.eclipse
.swt
.SWT
;
25 import org
.springframework
.security
.core
.GrantedAuthority
;
27 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
28 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacadeNotSupportedException
;
29 import eu
.etaxonomy
.cdm
.ext
.occurrence
.gbif
.GbifResponse
;
30 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
31 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
32 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
33 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
34 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
35 import eu
.etaxonomy
.cdm
.model
.description
.Character
;
36 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
37 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
38 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
39 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
40 import eu
.etaxonomy
.cdm
.model
.description
.SpecimenDescription
;
41 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
42 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
43 import eu
.etaxonomy
.cdm
.model
.molecular
.DnaSample
;
44 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
45 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
46 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
47 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
48 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
49 import eu
.etaxonomy
.cdm
.model
.occurrence
.MediaSpecimen
;
50 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationType
;
51 import eu
.etaxonomy
.cdm
.model
.permission
.CRUD
;
52 import eu
.etaxonomy
.cdm
.model
.permission
.Group
;
53 import eu
.etaxonomy
.cdm
.model
.permission
.User
;
54 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
55 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
56 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
57 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
58 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
59 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
60 import eu
.etaxonomy
.cdm
.model
.term
.DefinedTermBase
;
61 import eu
.etaxonomy
.cdm
.model
.term
.TermNode
;
62 import eu
.etaxonomy
.cdm
.model
.term
.TermTree
;
63 import eu
.etaxonomy
.cdm
.model
.term
.TermType
;
64 import eu
.etaxonomy
.cdm
.model
.term
.TermVocabulary
;
65 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermNodeDto
;
66 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermTreeDto
;
67 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeMap
;
68 import eu
.etaxonomy
.taxeditor
.editor
.IBulkEditor
;
69 import eu
.etaxonomy
.taxeditor
.editor
.IDistributionEditorPart
;
70 import eu
.etaxonomy
.taxeditor
.event
.WorkbenchEventConstants
;
71 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
72 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
73 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainer
;
74 import eu
.etaxonomy
.taxeditor
.model
.IDerivedUnitFacadePart
;
75 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
76 import eu
.etaxonomy
.taxeditor
.model
.PolytomousKeyRelationship
;
77 import eu
.etaxonomy
.taxeditor
.preference
.NameDetailsConfigurator
;
78 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
79 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
80 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
81 import eu
.etaxonomy
.taxeditor
.store
.UsageTermCollection
;
82 import eu
.etaxonomy
.taxeditor
.termtree
.e4
.ICharacterEditor
;
83 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
84 import eu
.etaxonomy
.taxeditor
.ui
.element
.RootElement
;
85 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.PersonDetailSection
;
86 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamDetailSection
;
87 import eu
.etaxonomy
.taxeditor
.ui
.section
.agent
.TeamOrPersonBaseDetailSection
;
88 import eu
.etaxonomy
.taxeditor
.ui
.section
.common
.ReferencedEntityDetailSection
;
89 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionDetailSection
;
90 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailElement
;
91 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementDetailSection
;
92 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementMediaSection
;
93 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionElementSourceSection
;
94 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.DescriptionSourceSection
;
95 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.MediaDetailsSection
;
96 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.NaturalLanguageSection
;
97 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ScopeSection
;
98 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.detail
.DistributionDetailElement
;
99 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.CharacterDetailSection
;
100 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.CharacterNodeDetailSection
;
101 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.CharacterNodeDtoDetailSection
;
102 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.FeatureDistributionDetailSection
;
103 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.TermNodeDetailSection
;
104 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.TermTreeDetailSection
;
105 import eu
.etaxonomy
.taxeditor
.ui
.section
.feature
.TermTreeDetailSectionForNode
;
106 import eu
.etaxonomy
.taxeditor
.ui
.section
.grantedAuthority
.GrantedAuthorityDetailSection
;
107 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.GroupDetailSection
;
108 import eu
.etaxonomy
.taxeditor
.ui
.section
.group
.MemberDetailSection
;
109 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyDetailSection
;
110 import eu
.etaxonomy
.taxeditor
.ui
.section
.key
.PolytomousKeyNodeDetailSection
;
111 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NameRelationshipDetailSection
;
112 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NomenclaturalStatusSection
;
113 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.NonViralNameDetailSection
;
114 import eu
.etaxonomy
.taxeditor
.ui
.section
.name
.TypeDesignationSection
;
115 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseDetailSection
;
116 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitGeneralDetailSection
;
117 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DeterminationDetailSection
;
118 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldUnitFacadeDetailSection
;
119 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldUnitFacadeGeneralDetailSection
;
120 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventDetailSection
;
121 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.association
.DerivedUnitTypeDesignationSection
;
122 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.association
.TaxonAssociationDetailSection
;
123 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaQualityDetailSection
;
124 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSampleGeneralDetailSection
;
125 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.DnaSamplePreparationPreservationSection
;
126 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SampleDesignationDetailSection
;
127 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceContigFileCollectionDetailSection
;
128 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceGeneralDetailSection
;
129 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SequenceReferenceCollectionDetailSection
;
130 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadGeneralDetailSection
;
131 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.SingleReadPherogramCollectionDetailSection
;
132 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
.TissueSampleGeneralDetailSection
;
133 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.media
.MediaSpecimenGeneralDetailSection
;
134 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.NomenclaturalSourceDetailSection
;
135 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.ReferenceDetailSection
;
136 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
137 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.identifier
.DerivedUnitFacadeIdentifierSection
;
138 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.ParsingMessagesSection
;
139 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonBaseDetailSection
;
140 import eu
.etaxonomy
.taxeditor
.ui
.section
.taxon
.TaxonRelationshipDetailSection
;
141 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.GroupsByUserDetailSection
;
142 import eu
.etaxonomy
.taxeditor
.ui
.section
.user
.UserDetailSection
;
143 import eu
.etaxonomy
.taxeditor
.ui
.section
.userecords
.UseRecordDetailSection
;
144 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.DefinedTermDetailSection
;
145 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermMediaSection
;
146 import eu
.etaxonomy
.taxeditor
.ui
.section
.vocabulary
.TermVocabularyDetailSection
;
147 import eu
.etaxonomy
.taxeditor
.view
.detail
.CdmSectionPart
;
148 import eu
.etaxonomy
.taxeditor
.view
.e4
.AbstractCdmDataViewer
;
151 * The DetailsViewer handles the content of the details view (
152 * {@link DetailsPartE4}).<br>
153 * Depending on the type of the selected element the section of the details view
159 public class DetailsViewerE4
extends AbstractCdmDataViewer
{
161 private ISelection selection
;
162 private boolean detailsEnabled
= true;
163 private Object activePart
;
165 public boolean isDetailsEnabled() {
166 return detailsEnabled
;
169 public void setDetailsEnabled(boolean detailsEnabled
) {
170 this.detailsEnabled
= detailsEnabled
;
173 public void setInput(Object input
, Object activePart
) {
174 this.activePart
= activePart
;
178 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
179 // since we are getting implementations of DerivedUnitBase from the bulk
181 // and not derived unit facade objects,
184 public void setInput(Object input
) {
186 if(input
instanceof TreeNode
){
187 input
= ((TreeNode
) input
).getValue();
189 if(input
instanceof GbifResponse
){
190 input
= ((GbifResponse
) input
).getDerivedUnitFacade();
192 if (input
instanceof DerivedUnit
) {
193 DerivedUnit derivedUnit
= (DerivedUnit
)input
;
194 if ((derivedUnit
instanceof MediaSpecimen
195 || (derivedUnit
instanceof DnaSample
&& derivedUnit
.getRecordBasis() == SpecimenOrObservationType
.DnaSample
))
196 && !(this.activePart
instanceof IBulkEditor
)){
200 input
= DerivedUnitFacade
.NewInstance(derivedUnit
,
201 PreferencesUtil
.getDerivedUnitConfigurator());
202 } catch (DerivedUnitFacadeNotSupportedException e
) {
203 MessagingUtils
.error(getClass(), e
); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
207 else if(input
instanceof FieldUnit
){
208 input
= DerivedUnitFacade
.NewInstance(SpecimenOrObservationType
.FieldUnit
, (FieldUnit
) input
);
210 super.setInput(input
);
216 protected void markViewPartDirty() {
217 if (getInput() instanceof DerivedUnitFacade
) {
218 if(part
instanceof IDerivedUnitFacadePart
){
219 part
.changed(getInput());
222 DerivedUnitFacade facade
= (DerivedUnitFacade
) getInput();
223 if(facade
.innerDerivedUnit()!=null){
224 part
.changed(facade
.innerDerivedUnit());
226 else if(facade
.innerFieldUnit()!=null){
227 part
.changed(facade
.innerFieldUnit());
232 super.markViewPartDirty();
237 protected void showParts() {
238 // FIXME (CM) : Need to clean out this code.
239 // Too much type checking to decide which detail view to display.
240 // Need to build in a mechanism where navigators / editors are 'aware'
241 // of the corresponding detail viewer.
243 Object input
= getInput();
248 if (input
instanceof TaxonBase
) {
249 if(((TaxonBase
<?
>) input
).getName()==null){
250 createEmptySection(Messages
.DetailsViewerE4_TAXON_HAS_NO_NAME
, rootElement
);
253 createTaxonSections(rootElement
);
255 } else if (input
instanceof TaxonName
) {
256 createNameSections(rootElement
);
257 } else if (input
instanceof Reference
) {
258 createReferenceSections(rootElement
);
260 } else if (input
instanceof Team
) {
261 createTeamDetailSection(rootElement
);
263 } else if (input
instanceof Person
) {
264 createPersonDetailSection(rootElement
);
266 } else if (input
instanceof TeamOrPersonBase
) {
267 createTeamOrPersonBaseDetailSection(rootElement
);
269 } else if (input
instanceof DescriptionBase
) {
270 if ((((DescriptionBase
<?
>)input
).isComputed() || ((DescriptionBase
<?
>)input
).isCloneForSource())&& PreferencesUtil
.isComputedDesciptionHandlingDisabled()){
271 this.setDetailsEnabled(false);
273 if(input
instanceof SpecimenDescription
){
274 //TODO: add more sections to DetailsView for SpecimenDescription
275 createSpecimenDescriptionSection(rootElement
);
278 Set
<Marker
> descriptionMarkers
= ((DescriptionBase
<?
>) input
).getMarkers();
280 Boolean isUseDescription
= false;
281 for (Marker marker
: descriptionMarkers
) {
282 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
283 isUseDescription
= true;
286 if (((DescriptionBase
<?
>) input
).isImageGallery()) {
287 createImageGallerySection(rootElement
);
289 } else if (isUseDescription
) {
290 createUseDescriptionSection(rootElement
);
291 } else if (input
instanceof TaxonDescription
){
292 createTaxonDescriptionSection(rootElement
, !(((DescriptionBase
<?
>) input
).isComputed() && PreferencesUtil
.isComputedDesciptionHandlingDisabled()));
295 createDescriptionSection(rootElement
, false, !(((DescriptionBase
<?
>) input
).isComputed() && PreferencesUtil
.isComputedDesciptionHandlingDisabled()));
298 } else if (input
instanceof DescriptionElementBase
){
299 Set
<Marker
> descriptionMarkers
= new HashSet
<>();
300 if(((DescriptionElementBase
) input
).getInDescription()!=null) {
301 descriptionMarkers
= ((DescriptionElementBase
) input
).getInDescription().getMarkers();
304 Boolean isUseDescription
= false;
305 for (Marker marker
: descriptionMarkers
) {
306 if (marker
.getMarkerType()!= null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
307 isUseDescription
= true;
310 if (((DescriptionElementBase
)input
).getInDescription() != null && ((DescriptionElementBase
)input
).getInDescription().isComputed() && PreferencesUtil
.isComputedDesciptionHandlingDisabled()){
311 this.setDetailsEnabled(false);
313 if (isUseDescription
== true && input
instanceof CategoricalData
) {
314 createUseRecordSection(rootElement
);
316 createDescriptionElementSection(rootElement
, activePart
);
319 } else if (input
instanceof Media
) {
320 createMediaElementSection(rootElement
);
322 //FIXME hack to show more informative message to the user when
323 //DerivedUnit has more than one FieldUnit #4363
324 else if (input
instanceof DerivedUnit
&& !(input
instanceof MediaSpecimen
) && !(input
instanceof DnaSample
)) {
325 DerivedUnit derivedUnit
= (DerivedUnit
)input
;
327 input
= DerivedUnitFacade
.NewInstance(derivedUnit
,
328 PreferencesUtil
.getDerivedUnitConfigurator());
329 } catch (DerivedUnitFacadeNotSupportedException e
) {
330 createEmptySection(e
.getMessage(), rootElement
);
332 } else if (input
instanceof DerivedUnitFacade
) {
333 DerivedUnitFacade facade
= (DerivedUnitFacade
) input
;
334 if(facade
.getType() == SpecimenOrObservationType
.FieldUnit
){
335 if(facade
.innerFieldUnit() == null){
336 MessagingUtils
.error(DetailsViewerE4
.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
339 createFieldUnitFacadeSection(rootElement
);
342 else if(facade
.getType() == SpecimenOrObservationType
.PreservedSpecimen
){
343 if(facade
.innerDerivedUnit() == null){
344 MessagingUtils
.error(DetailsViewerE4
.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
347 createDerivedUnitBaseElementSection(rootElement
);
350 else if(facade
.getType() == SpecimenOrObservationType
.TissueSample
){
351 //TissueSample should only be created by using it's own class
352 //in future using only one class with different SpecimenOrObservationTypes is desired
353 createTissueSampleSection(rootElement
);
354 }else if (facade
.innerDerivedUnit() instanceof DnaSample
){
355 createEmptySection("DNA sample not supported by specimen list editor", rootElement
);
356 }else if (facade
.innerDerivedUnit() instanceof MediaSpecimen
){
357 createEmptySection("Image specimen not supported by specimen list editor", rootElement
);
358 }else if(facade
.getType()==SpecimenOrObservationType
.DnaSample
){
360 if(facade
.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
361 //this case seems to be very unlikely as innerDerivedUnit in real cases should more or less always have the same type
362 createTissueSampleSection(rootElement
);
364 else if(facade
.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
365 createDnaSampleSection(rootElement
);
368 createDerivedUnitBaseElementSection(rootElement
);
370 } else if (input
instanceof DnaSample
){
371 DnaSample dnaSample
= (DnaSample
)input
;
372 if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
373 createTissueSampleSection(rootElement
);
375 else if(dnaSample
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
376 createDnaSampleSection(rootElement
);
378 } else if (input
instanceof MediaSpecimen
){
379 createMediaSpecimenSection(rootElement
);
381 else if(input
instanceof Sequence
){
382 createSequenceSection(rootElement
);
384 else if(input
instanceof SingleRead
){
385 createSingleReadSection(rootElement
);
387 else if (input
instanceof FeatureNodeContainer
) {
388 createFeatureDistributionSection(rootElement
);
390 } else if (input
instanceof TermNode
) {
391 TermType type
= ((TermNode
<?
>) input
).getTermType();
392 if(type
.equals(TermType
.Character
) ){
393 createCharacterNodeSection(rootElement
);
395 else if(type
.equals(TermType
.Feature
)){
396 createFeatureNodeSection(rootElement
);
399 } else if (input
instanceof TermTree
) {
400 createFeatureTreeSection(rootElement
);
401 } else if (input
instanceof TermNodeDto
) {
402 TermType type
= ((TermNodeDto
) input
).getTerm().getTermType();
403 if(type
.equals(TermType
.Character
) && activePart
instanceof ICharacterEditor
){
404 createCharacterNodeDtoSection(rootElement
);
406 else if(type
.equals(TermType
.Feature
) || type
.equals(TermType
.Character
)){
407 createFeatureNodeSection(rootElement
);
410 } else if (input
instanceof TermTreeDto
) {
411 createFeatureTreeSectionForDto(rootElement
);
413 } else if (input
instanceof Character
) {
414 createCharacterSection(rootElement
);
416 }else if ((input
instanceof PolytomousKeyNode
) || (input
instanceof PolytomousKeyRelationship
)) {
417 createPolytomousKeyNodeSection(rootElement
);
418 } else if (input
instanceof User
) {
419 createUserSection(rootElement
);
420 } else if (input
instanceof Group
) {
421 createGroupSection(rootElement
);
422 } else if (input
instanceof TaxonRelationship
&& ((TaxonRelationship
)input
).getType()!=null
423 && (((TaxonRelationship
)input
).getType().isAnyMisappliedName() || ((TaxonRelationship
)input
).getType().isAnySynonym() || ((TaxonRelationship
)input
).getType().isMisappliedName())){
424 createMisappliedNameSection(rootElement
);
425 }else if (input
instanceof TaxonRelationship
) {
426 createTaxonRelationshipSection(rootElement
);
427 } else if (input
instanceof TermVocabulary
) {
428 createTermVocabularySection(rootElement
);
429 } else if (input
instanceof DefinedTermBase
) {
430 createDefinedTermSection(rootElement
);
432 } else if (input
instanceof SelectionChangedEvent
) {
433 IStructuredSelection sel
=(IStructuredSelection
) ((SelectionChangedEvent
)input
).getSelection();
434 if (sel
.getFirstElement()instanceof Distribution
){
435 createDescriptionElementSection(rootElement
);
438 // createDescriptionElementSection(rootElement);
441 createEmptySection(null, rootElement
);
446 private void createGroupSection(RootElement parent
) {
447 GroupDetailSection groupDetailSection
= formFactory
.createGroupDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(GroupDetailSection
.class, getInput().getClass().getCanonicalName()));
448 MemberDetailSection memberDetailSection
= formFactory
.createMemberDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(MemberDetailSection
.class, getInput().getClass().getCanonicalName()));
449 GrantedAuthorityDetailSection grantedAuthorityDetailSection
= formFactory
.createGrantedAuthorityDetailSection(getConversationHolder(), parent
,StoreUtil
.getSectionStyle(GrantedAuthorityDetailSection
.class, getInput().getClass().getCanonicalName()));
451 addPart(groupDetailSection
);
452 addPart(memberDetailSection
);
453 addPart(grantedAuthorityDetailSection
);
457 public ISelection
getSelection() {
462 public void setSelection(ISelection selection
, boolean reveal
) {
464 this.selection
= selection
;
465 if(this.selection
!=null){
466 SelectionChangedEvent selectionChangedEvent
= new SelectionChangedEvent(this, selection
);
467 fireSelectionChanged(selectionChangedEvent
);
471 private void createTaxonSections(RootElement parent
) {
472 NameDetailsConfigurator config
= PreferencesUtil
.getPreferredNameDetailsConfiguration();
473 EnumSet
<CRUD
> requiredCrud
;
474 if(getInput() == null || StoreUtil
.getCdmEntity(getInput()).getId() == 0) {
475 // new entity, not yet saved
476 requiredCrud
= EnumSet
.of(CRUD
.CREATE
);
478 requiredCrud
= EnumSet
.of(CRUD
.UPDATE
);
480 boolean hasPermission
= CdmStore
.currentAuthentiationHasPermission(StoreUtil
.getCdmEntity(getInput()), requiredCrud
);
481 TaxonBase
<?
> taxonBase
= (TaxonBase
<?
>)getInput();
483 // check for subtree permissions as well.
485 Taxon acceptedTaxon
= null;
486 if (taxonBase
instanceof Taxon
){
487 acceptedTaxon
= (Taxon
)taxonBase
;
489 acceptedTaxon
= ((Synonym
)taxonBase
).getAcceptedTaxon();
491 if (acceptedTaxon
!= null){ //needs discussion if synonyms without accepted taxon should never be filtered by subtree permission(current implementation). See also #8849
492 Set
<TaxonNode
> nodes
= acceptedTaxon
.getTaxonNodes();
493 for (TaxonNode node
: nodes
){
494 hasPermission
&= CdmStore
.currentAuthentiationHasPermission(node
, requiredCrud
);
496 //check whether there are explicit TaxonNode rights
497 boolean taxonnodePermissionExists
= false;
498 Collection
<?
extends GrantedAuthority
> authorities
= CdmStore
.getCurrentAuthentiation().getAuthorities();
499 for (GrantedAuthority grantedAuthority
: authorities
){
500 if (grantedAuthority
.getAuthority().startsWith("TAXONNODE")){
501 taxonnodePermissionExists
= true;
504 if (!taxonnodePermissionExists
){
505 hasPermission
= true;
511 detailsEnabled
= hasPermission
;
512 ParsingMessagesSection parsingMessagesSection
= formFactory
.createParsingMessagesSection(getConversationHolder(), parent
, this,
513 StoreUtil
.getSectionStyle(ParsingMessagesSection
.class, getInput().getClass().getCanonicalName(), true));
515 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
516 StoreUtil
.getSectionStyle(TaxonBaseDetailSection
.class, getInput().getClass().getCanonicalName(), true));
517 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
518 // boolean hasPermission = CdmStore.currentAuthentiationHasPermission(getInput(), Operation.UPDATE);
519 taxonBaseDetailSection
.setEnabled(detailsEnabled
);
520 addPart(taxonBaseDetailSection
);
522 if (config
.isTaxonSectionActivated()){
523 TaxonBaseDetailSection taxonBaseDetailSection
= formFactory
.createTaxonBaseDetailSection(getConversationHolder(), parent
, this,
524 StoreUtil
.getSectionStyle(TaxonBaseDetailSection
.class, getInput().getClass().getCanonicalName(), true));
525 taxonBaseDetailSection
.setEnabled(detailsEnabled
);
526 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
527 addPart(taxonBaseDetailSection
);
530 //TODO: test code for secundum source section
531 // SecundumSourceSection sourceSection = formFactory.createSecundumDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SecundumSourceSection.class, getInput().getClass().getCanonicalName(), true));
532 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
533 // addPart(sourceSection);
534 // if (taxonBase.getSecSource() == null){
535 // SecundumSource source = SecundumSource.NewSecundumInstance(taxonBase);
536 // taxonBase.setSecSource(source);
537 // sourceSection.setEntity(taxonBase);
539 // sourceSection.setEntity(taxonBase);
542 // if (config != null && !config.isSecEnabled()){
543 // sourceSection.setEnabled(false);
545 NonViralNameDetailSection nonViralNameSection
= formFactory
546 .createNonViralNameDetailSection(getConversationHolder(), parent
, this, true,
547 StoreUtil
.getSectionStyle(NonViralNameDetailSection
.class, getInput().getClass().getCanonicalName(), true));
548 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
549 nonViralNameSection
.setEnabled(detailsEnabled
);
550 if (config
== null || config
.isNomenclaturalReferenceSectionActivated()){
551 NomenclaturalSourceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
552 StoreUtil
.getSectionStyle(NomenclaturalSourceDetailSection
.class, getInput().getClass().getCanonicalName(), true));
553 referenceDetailSection
.setEnabled(detailsEnabled
);
554 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
555 addPart(referenceDetailSection
);
558 if ( config
== null || config
.isNomenclaturalStatusSectionActivated()){
559 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
560 StoreUtil
.getSectionStyle(NomenclaturalStatusSection
.class, getInput().getClass().getCanonicalName(), true));
561 nomenclaturalStatusSection
.setEnabled(detailsEnabled
);
562 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
563 addPart(nomenclaturalStatusSection
);
566 // if ( config == null || config.isProtologueActivated()){
567 // ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
568 // protologSection.setEnabled(detailsEnabled);
569 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
570 // addPart(protologSection);
573 if (config
== null || config
.isTypeDesignationSectionActivated()){
574 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(TypeDesignationSection
.class, getInput().getClass().getCanonicalName()));
575 typeDesignationSection
.setEnabled(detailsEnabled
);
576 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
577 addPart(typeDesignationSection
);
580 if (config
== null || config
.isNameRelationsSectionActivated()){
581 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(NameRelationshipDetailSection
.class, getInput().getClass().getCanonicalName()));
582 nameRelationshipSection
.setEnabled(detailsEnabled
);
583 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
584 addPart(nameRelationshipSection
);
587 addPart(parsingMessagesSection
);
588 addPart(nonViralNameSection
);
591 private void createNameSections(RootElement parent
) {
592 NonViralNameDetailSection nonViralNameSection
= formFactory
.createNonViralNameDetailSection(
593 getConversationHolder(), parent
, this, false, StoreUtil
.getSectionStyle(NonViralNameDetailSection
.class, getInput().getClass().getCanonicalName(), true));
595 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
597 NomenclaturalSourceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
598 StoreUtil
.getSectionStyle(NomenclaturalSourceDetailSection
.class, getInput().getClass().getCanonicalName(), true));
599 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
601 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
602 StoreUtil
.getSectionStyle(NomenclaturalStatusSection
.class, getInput().getClass().getCanonicalName(), true));
603 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
605 addPart(nonViralNameSection
);
606 addPart(nomenclaturalStatusSection
);
607 addPart(referenceDetailSection
);
609 // ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
610 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
612 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(TypeDesignationSection
.class, getInput().getClass().getCanonicalName()));
613 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
615 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(NameRelationshipDetailSection
.class, getInput().getClass().getCanonicalName()));
616 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
617 // addPart(protologSection);
618 addPart(typeDesignationSection
);
619 addPart(nameRelationshipSection
);
622 private void createReferenceSections(RootElement parent
) {
623 ReferenceDetailSection referenceDetailSection
= formFactory
.createReferenceDetailSection(getConversationHolder(), parent
, this,
624 StoreUtil
.getSectionStyle(ReferenceDetailSection
.class, getInput().getClass().getCanonicalName(), true));
626 addPart(referenceDetailSection
);
629 private void createTeamOrPersonBaseDetailSection(RootElement parent
) {
630 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection
= formFactory
.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TeamOrPersonBaseDetailSection
.class, getInput().getClass().getCanonicalName(), true));
632 addPart(teamOrPersonBaseDetailSection
);
635 private void createTeamDetailSection(RootElement parent
) {
636 TeamDetailSection teamDetailSection
= formFactory
.createTeamDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(TeamDetailSection
.class, getInput().getClass().getCanonicalName(), true));
638 addPart(teamDetailSection
);
641 private void createPersonDetailSection(RootElement parent
) {
642 PersonDetailSection personDetailSection
= formFactory
.createPersonDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(PersonDetailSection
.class, getInput().getClass().getCanonicalName(), true));
643 addPart(personDetailSection
);
646 private void createDescriptionElementSection(RootElement parent
) {
647 createDescriptionElementSection(parent
, null);
650 private void createDescriptionElementSection(RootElement parent
, Object activePart
) {
651 DescriptionElementDetailSection descriptionElementDetailSection
= formFactory
.createDescriptionElementDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DescriptionElementDetailSection
.class, getInput().getClass().getCanonicalName(), true));
654 // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, getSectionStyle(.class, getInput().getClass().getCanonicalName()));
656 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
657 DescriptionElementSourceSection descriptionElementSourceSection
;
658 if (activePart
!= null && activePart
instanceof IDistributionEditorPart
){
659 Reference defaultSource
=((IDistributionEditorPart
)activePart
).getEditor().getDefaultSource();
660 descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, defaultSource
, StoreUtil
.getSectionStyle(DescriptionElementSourceSection
.class, getInput().getClass().getCanonicalName()));
663 descriptionElementSourceSection
= formFactory
.createDescriptionElementSourceSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(DescriptionElementSourceSection
.class, getInput().getClass().getCanonicalName()) );
664 descriptionElementSourceSection
.setEnabled(this.detailsEnabled
);
669 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
671 DescriptionElementMediaSection descriptionElementMediaSection
= formFactory
.createDescriptionElementMediaSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(DescriptionElementMediaSection
.class, getInput().getClass().getCanonicalName()));
673 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
675 addPart(descriptionElementDetailSection
);
676 addPart(descriptionElementSourceSection
);
677 addPart(descriptionElementMediaSection
);
680 private void createDescriptionSection(RootElement parent
, boolean isTaxonDescription
, boolean isEnabled
) {
681 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DescriptionDetailSection
.class, getInput().getClass().getCanonicalName(), true));
682 descriptionDetailSection
.setEnabled(isEnabled
);
683 addPart(descriptionDetailSection
);
685 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
687 if(isTaxonDescription
) {
688 NaturalLanguageSection naturalLanguageSection
= formFactory
.createNaturalLanguageSection(
689 getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(NaturalLanguageSection
.class, getInput().getClass().getCanonicalName(), true));
690 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
691 naturalLanguageSection
.setEnabled(isEnabled
);
692 addPart(naturalLanguageSection
);
694 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(
695 getConversationHolder(), parent
, StoreUtil
.getSectionStyle(DescriptionSourceSection
.class, getInput().getClass().getCanonicalName(), true));
696 descriptionSourceSection
.setEnabled(isEnabled
);
697 addPart(descriptionSourceSection
);
699 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
701 if(isTaxonDescription
) {
702 ScopeSection scopeSection
= formFactory
.createScopeSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(ScopeSection
.class, getInput().getClass().getCanonicalName()));
703 scopeSection
.setEnabled(isEnabled
);
704 addPart(scopeSection
);
708 private void createTaxonDescriptionSection(RootElement parent
, boolean isEnabled
) {
709 createDescriptionSection(parent
, true, isEnabled
);
712 private void createSpecimenDescriptionSection(RootElement parent
) {
713 createDescriptionSection(parent
, false, true);
716 private void createUseDescriptionSection(RootElement parent
) {
717 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DescriptionDetailSection
.class, getInput().getClass().getCanonicalName()));
719 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
721 DescriptionSourceSection descriptionSourceSection
= formFactory
.createDescriptionSourceSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(DescriptionSourceSection
.class, getInput().getClass().getCanonicalName()));
723 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
725 addPart(descriptionDetailSection
);
726 addPart(descriptionSourceSection
);
729 private void createImageGallerySection(RootElement parent
) {
730 DescriptionDetailSection descriptionDetailSection
= formFactory
.createDescriptionDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DescriptionDetailSection
.class, getInput().getClass().getCanonicalName()));
732 addPart(descriptionDetailSection
);
735 private void createMediaElementSection(RootElement parent
) {
736 MediaDetailsSection mediaDetailSection
= formFactory
.createMediaDetailsSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(MediaDetailsSection
.class, getInput().getClass().getCanonicalName(), true));
738 addPart(mediaDetailSection
);
741 private void createDerivedUnitBaseElementSection(RootElement parent
) {
742 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection
= formFactory
.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DerivedUnitGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
743 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
744 if(!(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
)){
745 derivedUnitGeneralDetailSection
.setShowOnlyDerivedUnitData(true);
747 addPart(derivedUnitGeneralDetailSection
);
749 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
751 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection
= formFactory
.createDerivedUnitBaseDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DerivedUnitBaseDetailSection
.class, getInput().getClass().getCanonicalName(), true));
752 addPart(derivedUnitBaseDetailSection
);
754 //for editors working with facades
755 if(AbstractUtility
.getActivePart() instanceof IDerivedUnitFacadePart
){
756 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
757 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(GatheringEventDetailSection
.class, getInput().getClass().getCanonicalName()));
758 addPart(gatheringEventDetailSection
);
760 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
761 FieldUnitFacadeDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitFacadeDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(FieldUnitFacadeDetailSection
.class, getInput().getClass().getCanonicalName()));
762 addPart(fieldUnitDetailSection
);
766 if(PreferencesUtil
.isShowTaxonAssociations()){
767 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
768 TaxonAssociationDetailSection taxonAssociationDetailSection
= formFactory
.createTaxonAssociationDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TaxonAssociationDetailSection
.class, getInput().getClass().getCanonicalName(), true));
769 addPart(taxonAssociationDetailSection
);
771 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
772 DerivedUnitFacadeIdentifierSection identifierDetailSection
= formFactory
.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(DerivedUnitFacadeIdentifierSection
.class, getInput().getClass().getCanonicalName()));
773 addPart(identifierDetailSection
);
775 if(!PreferencesUtil
.isDeterminationOnlyForFieldUnits()){
776 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
777 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DeterminationDetailSection
.class, getInput().getClass().getCanonicalName()));
778 addPart(determinationDetailSection
);
781 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
782 DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection
= formFactory
.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DerivedUnitTypeDesignationSection
.class, getInput().getClass().getCanonicalName()));
783 addPart(derivedUnitTypeDesignationSection
);
786 private void createFieldUnitFacadeSection(RootElement parent
) {
787 FieldUnitFacadeGeneralDetailSection fielUnitGeneralDetailSection
= formFactory
.createFieldUnitFacadeGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(FieldUnitFacadeGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
789 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
791 GatheringEventDetailSection gatheringEventDetailSection
= formFactory
.createGatheringEventDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(GatheringEventDetailSection
.class, getInput().getClass().getCanonicalName()));
793 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
795 FieldUnitFacadeDetailSection fieldUnitDetailSection
= formFactory
.createFieldUnitFacadeDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(FieldUnitFacadeDetailSection
.class, getInput().getClass().getCanonicalName()));
797 addPart(fielUnitGeneralDetailSection
);
798 addPart(gatheringEventDetailSection
);
799 addPart(fieldUnitDetailSection
);
801 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
802 DeterminationDetailSection determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DeterminationDetailSection
.class, getInput().getClass().getCanonicalName()));
803 addPart(determinationDetailSection
);
806 private void createTissueSampleSection(RootElement parent
) {
807 TissueSampleGeneralDetailSection section
= formFactory
.createTissueSampleGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TissueSampleGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
809 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
811 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(SampleDesignationDetailSection
.class, getInput().getClass().getCanonicalName(), true));
814 addPart(sampleDesignationDetailSection
);
817 private void createDnaSampleSection(RootElement parent
) {
818 DnaSampleGeneralDetailSection section
= formFactory
.createDnaSampleGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DnaSampleGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
820 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
822 DnaSamplePreparationPreservationSection preparationPreservationSection
= formFactory
.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DnaSamplePreparationPreservationSection
.class, getInput().getClass().getCanonicalName(), true));
824 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
826 DnaQualityDetailSection qualitySection
= formFactory
.createDnaQualityDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DnaQualityDetailSection
.class, getInput().getClass().getCanonicalName(), true));
828 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
830 SampleDesignationDetailSection sampleDesignationDetailSection
= formFactory
.createSampleDesignationDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(SampleDesignationDetailSection
.class, getInput().getClass().getCanonicalName(), true));
832 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
833 DeterminationDetailSection determinationDetailSection
= null;
834 if(!PreferencesUtil
.isDeterminationOnlyForFieldUnits()){
835 determinationDetailSection
= formFactory
.createDeterminationDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DeterminationDetailSection
.class, getInput().getClass().getCanonicalName()));
838 addPart(preparationPreservationSection
);
839 addPart(qualitySection
);
840 addPart(sampleDesignationDetailSection
);
841 if(!PreferencesUtil
.isDeterminationOnlyForFieldUnits()){
842 addPart(determinationDetailSection
);
846 private void createSequenceSection(RootElement parent
) {
847 SequenceGeneralDetailSection section
= formFactory
.createSequenceGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(SequenceGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
849 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
851 SequenceReferenceCollectionDetailSection referenceSection
= formFactory
.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(SequenceReferenceCollectionDetailSection
.class, getInput().getClass().getCanonicalName(), true));
853 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
855 SequenceContigFileCollectionDetailSection contigFileSection
= formFactory
.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(SequenceContigFileCollectionDetailSection
.class, getInput().getClass().getCanonicalName(), true));
858 addPart(referenceSection
);
859 addPart(contigFileSection
);
862 private void createSingleReadSection(RootElement parent
) {
863 SingleReadGeneralDetailSection section
= formFactory
.createSingleReadGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(SingleReadGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
866 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
868 SingleReadPherogramCollectionDetailSection pherogramSection
= formFactory
.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(SingleReadPherogramCollectionDetailSection
.class, getInput().getClass().getCanonicalName(), true));
869 addPart(pherogramSection
);
872 private void createMediaSpecimenSection(RootElement parent
) {
873 MediaSpecimenGeneralDetailSection generalSection
= formFactory
.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(MediaSpecimenGeneralDetailSection
.class, getInput().getClass().getCanonicalName(), true));
874 addPart(generalSection
);
876 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
878 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(RightsSection
.class, getInput().getClass().getCanonicalName()));
879 // rightsSection.setEntity(generalSection.getEntity().innerDerivedUnit());
880 addPart(rightsSection
);
883 private void createFeatureTreeSectionForDto(RootElement parent
) {
884 TermTreeDetailSection section
= formFactory
.createFeatureTreeDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TermTreeDetailSection
.class, getInput().getClass().getCanonicalName(), true));
888 private void createFeatureTreeSection(RootElement parent
) {
889 TermTreeDetailSectionForNode section
= formFactory
.createFeatureTreeDetailSectionForTree(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TermTreeDetailSection
.class, getInput().getClass().getCanonicalName(), true));
893 private void createFeatureNodeSection(RootElement parent
) {
894 TermNodeDetailSection featureDistributionSection
= formFactory
.createFeatureNodeDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TermNodeDetailSection
.class, getInput().getClass().getCanonicalName(), true));
895 addPart(featureDistributionSection
);
898 private void createFeatureDistributionSection(RootElement parent
) {
899 FeatureDistributionDetailSection featureDistributionSection
= formFactory
.createFeatureDistributionDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(FeatureDistributionDetailSection
.class, getInput().getClass().getCanonicalName(), true));
900 addPart(featureDistributionSection
);
903 private void createCharacterNodeSection(RootElement parent
) {
904 CharacterNodeDetailSection featureDistributionSection
= formFactory
.createCharacterNodeDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(CharacterDetailSection
.class, getInput().getClass().getCanonicalName(), true));
905 addPart(featureDistributionSection
);
908 private void createCharacterNodeDtoSection(RootElement parent
) {
909 CharacterNodeDtoDetailSection featureDistributionSection
= formFactory
.createCharacterNodeDtoDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(CharacterDetailSection
.class, getInput().getClass().getCanonicalName(), true));
910 addPart(featureDistributionSection
);
913 private void createCharacterSection(RootElement parent
) {
914 CharacterDetailSection featureDistributionSection
= formFactory
.createCharacterDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(CharacterDetailSection
.class, getInput().getClass().getCanonicalName(), true));
915 addPart(featureDistributionSection
);
918 private void createPolytomousKeyNodeSection(RootElement parent
) {
919 PolytomousKeyDetailSection polytomousKeyDetailSection
= formFactory
.createPolytomousKeyDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(PolytomousKeyDetailSection
.class, getInput().getClass().getCanonicalName()));
921 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
923 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection
= formFactory
.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(PolytomousKeyNodeDetailSection
.class, getInput().getClass().getCanonicalName(), true));
925 addPart(polytomousKeyDetailSection
);
926 addPart(polytomousKeyNodeDetailSection
);
930 private void createUseRecordSection(RootElement parent
) {
931 UseRecordDetailSection descriptionUseRecordSection
= formFactory
.createUseRecordDetailSection(getConversationHolder(), parent
, this,StoreUtil
.getSectionStyle(UseRecordDetailSection
.class, getInput().getClass().getCanonicalName(), true));
932 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
933 addPart(descriptionUseRecordSection
);
936 private void createUserSection(RootElement parent
) {
937 UserDetailSection userDetailSection
= formFactory
.createUserDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(UserDetailSection
.class, getInput().getClass().getCanonicalName(), true));
939 GroupsByUserDetailSection groupByUserDetailSection
= formFactory
.createGroupsByUserDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(GroupsByUserDetailSection
.class, getInput().getClass().getCanonicalName(), true));
941 addPart(userDetailSection
);
942 addPart(groupByUserDetailSection
);
945 private void createMisappliedNameSection(RootElement parent
) {
946 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this,
947 StoreUtil
.getSectionStyle(TaxonRelationshipDetailSection
.class, getInput().getClass().getCanonicalName(), true));
948 addPart(taxonRelationshipDetailSection
);
950 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
952 NonViralNameDetailSection nonViralNameSection
= formFactory
953 .createNonViralNameDetailSection(getConversationHolder(), parent
, this, true,
954 StoreUtil
.getSectionStyle(NonViralNameDetailSection
.class, getInput().getClass().getCanonicalName(), true));
955 addPart(nonViralNameSection
);
957 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
959 NomenclaturalSourceDetailSection referenceDetailSection
= formFactory
.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent
, this,
960 StoreUtil
.getSectionStyle(NomenclaturalSourceDetailSection
.class, getInput().getClass().getCanonicalName(), true));
961 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
962 addPart(referenceDetailSection
);
964 NomenclaturalStatusSection nomenclaturalStatusSection
= formFactory
.createNomenclaturalStatusSection(getConversationHolder(), parent
,
965 StoreUtil
.getSectionStyle(NomenclaturalStatusSection
.class, getInput().getClass().getCanonicalName(), true));
966 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
967 addPart(nomenclaturalStatusSection
);
969 // ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
970 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
971 // addPart(protologSection);
973 TypeDesignationSection typeDesignationSection
= formFactory
.createTypeDesignationSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(TypeDesignationSection
.class, getInput().getClass().getCanonicalName()));
974 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
975 addPart(typeDesignationSection
);
977 NameRelationshipDetailSection nameRelationshipSection
= formFactory
.createNameRelationshipDetailSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(NameRelationshipDetailSection
.class, getInput().getClass().getCanonicalName()));
978 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
979 addPart(nameRelationshipSection
);
982 private void createTaxonRelationshipSection(RootElement parent
) {
983 TaxonRelationshipDetailSection taxonRelationshipDetailSection
= formFactory
.createTaxonRelationshipDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TaxonRelationshipDetailSection
.class, getInput().getClass().getCanonicalName(), true));
985 ReferencedEntityDetailSection referencedEntityBaseDetailSection
= formFactory
.createReferencedEntityDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(ReferencedEntityDetailSection
.class, getInput().getClass().getCanonicalName(), true));
986 addPart(taxonRelationshipDetailSection
);
987 addPart(referencedEntityBaseDetailSection
);
989 private void createTermVocabularySection(RootElement parent
) {
990 TermVocabularyDetailSection termVocabularyDetailSection
= formFactory
.createTermVocabularyDetailSection(getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(TermVocabularyDetailSection
.class, getInput().getClass().getCanonicalName(), true));
991 addPart(termVocabularyDetailSection
);
994 private void createDefinedTermSection(RootElement parent
) {
995 DefinedTermDetailSection
<?
> definedTermDetailSection
= formFactory
.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent
, this, StoreUtil
.getSectionStyle(DefinedTermDetailSection
.class, getInput().getClass().getCanonicalName(), true));
996 addPart(definedTermDetailSection
);
997 TermMediaSection termMediaSection
= formFactory
.createTermMediaSection(getConversationHolder(), parent
, StoreUtil
.getSectionStyle(DefinedTermDetailSection
.class, getInput().getClass().getCanonicalName(), true));
998 addPart(termMediaSection
);
1002 public void update(CdmDataChangeMap arg0
) {
1007 private void updateView(@UIEventTopic(WorkbenchEventConstants
.REFRESH_DETAILS
)boolean refresh
){
1015 private void updateView(@UIEventTopic(WorkbenchEventConstants
.REFRESH_DETAILS_DISTRIBUTION
)String nameCache
){
1016 if(nameCache
!= null && getInput() instanceof Distribution
&& this.activePart
instanceof IDistributionEditorPart
){
1017 if (part
instanceof CdmSectionPart
&& ((CdmSectionPart
<?
>)part
).getSection() instanceof DescriptionElementDetailSection
){
1018 for (ICdmFormElement element
: ((DescriptionElementDetailSection
)((CdmSectionPart
<?
>)part
).getSection()).getElements()){
1019 if (element
instanceof DescriptionElementDetailElement
){
1020 for(ICdmFormElement descriptionElement
:((DescriptionElementDetailElement
)element
).getElements()){
1021 if (descriptionElement
instanceof DistributionDetailElement
){
1022 ((DistributionDetailElement
) descriptionElement
).setName(nameCache
);