Project

General

Profile

Download (48.9 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2011 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
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.
8
 */
9

    
10
package eu.etaxonomy.taxeditor.view.e4.details;
11

    
12
import java.util.ArrayList;
13
import java.util.HashSet;
14
import java.util.List;
15
import java.util.Set;
16

    
17
import javax.inject.Inject;
18

    
19
import org.eclipse.e4.core.di.annotations.Optional;
20
import org.eclipse.e4.ui.di.UIEventTopic;
21
import org.eclipse.jface.viewers.ISelection;
22
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.jface.viewers.SelectionChangedEvent;
24
import org.eclipse.jface.viewers.TreeNode;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.ui.forms.widgets.ExpandableComposite;
27

    
28
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
29
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
30
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
31
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
32
import eu.etaxonomy.cdm.model.agent.Person;
33
import eu.etaxonomy.cdm.model.agent.Team;
34
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
35
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
36
import eu.etaxonomy.cdm.model.common.Group;
37
import eu.etaxonomy.cdm.model.common.Marker;
38
import eu.etaxonomy.cdm.model.common.TermVocabulary;
39
import eu.etaxonomy.cdm.model.common.User;
40
import eu.etaxonomy.cdm.model.description.CategoricalData;
41
import eu.etaxonomy.cdm.model.description.Character;
42
import eu.etaxonomy.cdm.model.description.DescriptionBase;
43
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
44
import eu.etaxonomy.cdm.model.description.Distribution;
45
import eu.etaxonomy.cdm.model.description.FeatureNode;
46
import eu.etaxonomy.cdm.model.description.FeatureTree;
47
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
48
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
49
import eu.etaxonomy.cdm.model.media.Media;
50
import eu.etaxonomy.cdm.model.molecular.DnaSample;
51
import eu.etaxonomy.cdm.model.molecular.Sequence;
52
import eu.etaxonomy.cdm.model.molecular.SingleRead;
53
import eu.etaxonomy.cdm.model.name.TaxonName;
54
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
55
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
56
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
57
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
58
import eu.etaxonomy.cdm.model.reference.Reference;
59
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
60
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
61
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
62
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
63
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
64
import eu.etaxonomy.taxeditor.l10n.Messages;
65
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
66
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
67
import eu.etaxonomy.taxeditor.model.MessagingUtils;
68
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
69
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
70
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
71
import eu.etaxonomy.taxeditor.store.UsageTermCollection;
72
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
73
import eu.etaxonomy.taxeditor.ui.element.RootElement;
74
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
80
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
81
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
82
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
83
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
84
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
85
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
86
import eu.etaxonomy.taxeditor.ui.section.feature.CharacterDetailSection;
87
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
88
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureNodeDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureTreeDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
91
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
92
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
93
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
94
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
95
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
96
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
97
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
98
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
99
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
100
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
101
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
102
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
103
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
104
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
105
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
106
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
107
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
108
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
109
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
110
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
111
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
112
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
113
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
114
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
115
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
116
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
117
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
118
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
119
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
120
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
121
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
122
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
123
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
124
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
125
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
126
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
127
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
128
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
129
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
130
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
131

    
132
/**
133
 *
134
 * The DetailsViewer handles the content of the details view (
135
 * {@link DetailsViewerE4}).<br>
136
 * Depending on the type of the selected element the section of the details view
137
 * are created.
138
 *
139
 * @author pplitzner
140
 * @date 18.07.2017
141
 *
142
 */
143
public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
144

    
145
    private ISelection selection;
146
    private boolean detailsEnabled = true;
147

    
148
    public boolean isDetailsEnabled() {
149
		return detailsEnabled;
150
	}
151

    
152
	public void setDetailsEnabled(boolean detailsEnabled) {
153
		this.detailsEnabled = detailsEnabled;
154
	}
155

    
156
	public void setInput(Object input, Object activePart) {
157
        if (activePart instanceof IDistributionEditor){
158
            detailsEnabled = false;
159
        }else{
160
            detailsEnabled = true;
161
        }
162
        setInput(input);
163

    
164
    }
165
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
166
    // since we are getting implementations of DerivedUnitBase from the bulk
167
    // editor
168
    // and not derived unit facade objects,
169

    
170
    @Override
171
    public void setInput(Object input) {
172

    
173
        if(input instanceof TreeNode){
174
            input = ((TreeNode) input).getValue();
175
        }
176
        if(input instanceof GbifResponse){
177
            input = ((GbifResponse) input).getDerivedUnitFacade();
178
        }
179
        if(input instanceof FeatureNode
180
                && HibernateProxyHelper.isInstanceOf(((FeatureNode) input).getFeature(), Character.class)){
181
            input = HibernateProxyHelper.deproxy(((FeatureNode) input).getFeature(), Character.class);
182
        }
183
        if (input !=null && input.getClass().equals(DerivedUnit.class)) {
184
            DerivedUnit derivedUnit = (DerivedUnit)input;
185
            try {
186
                input = DerivedUnitFacade.NewInstance(derivedUnit,
187
                        PreferencesUtil.getDerivedUnitConfigurator());
188
            } catch (DerivedUnitFacadeNotSupportedException e) {
189
                //                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
190
            }
191
        }
192
        else if(input instanceof FieldUnit){
193
            input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
194
        }
195
        super.setInput(input);
196
    }
197

    
198
    @Override
199
    protected void markViewPartDirty() {
200
        if (getInput() instanceof DerivedUnitFacade) {
201
            if(part instanceof IDerivedUnitFacadePart){
202
                part.changed(getInput());
203
            }
204
            else{
205
                DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
206
                if(facade.innerDerivedUnit()!=null){
207
                    part.changed(facade.innerDerivedUnit());
208
                }
209
                else if(facade.innerFieldUnit()!=null){
210
                    part.changed(facade.innerFieldUnit());
211
                }
212
            }
213
        }
214
        else{
215
            super.markViewPartDirty();
216
        }
217
    }
218

    
219
    private boolean isCached(String id){
220
        List<AbstractFormSection> sections = entityToSectionsMap.get(id);
221
        if(sections!=null){
222
            managedForm.setInput(getInput());
223
            return true;
224
        }
225
        return false;
226
    }
227

    
228
    /** {@inheritDoc} */
229
    @Override
230
    protected void showParts() {
231
        // FIXME (CM) : Need to clean out this code.
232
        // Too much type checking to decide which detail view to display.
233
        // Need to build in a mechanism where navigators / editors are 'aware'
234
        // of the corresponding detail viewer.
235

    
236
        Object input = getInput();
237

    
238
        if (input instanceof TaxonBase) {
239
            if(((TaxonBase) input).getName()==null){
240
                createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
241
            }
242
            else{
243
                createTaxonSections(rootElement);
244
            }
245

    
246
        } else if (input instanceof TaxonName) {
247
            createNameSections(rootElement);
248

    
249
        } else if (input instanceof Reference) {
250
            createReferenceSections(rootElement);
251

    
252
        } else if (input instanceof Team) {
253
            createTeamDetailSection(rootElement);
254

    
255
        } else if (input instanceof Person) {
256
            createPersonDetailSection(rootElement);
257

    
258
        } else if (input instanceof TeamOrPersonBase) {
259
            createTeamOrPersonBaseDetailSection(rootElement);
260

    
261
        } else if (input instanceof DescriptionBase) {
262
            if(input instanceof SpecimenDescription){
263
                //TODO: add more sections to DetailsView for SpecimenDescription
264
                createSpecimenDescriptionSection(rootElement);
265
            }
266
            else{
267
                Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
268

    
269
                Boolean isUseDescription = false;
270
                for (Marker marker : descriptionMarkers) {
271
                    if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
272
                        isUseDescription = true;
273
                    }
274
                }
275
                if (((DescriptionBase<?>) input).isImageGallery()) {
276
                    createImageGallerySection(rootElement);
277

    
278
                } else if (isUseDescription) {
279
                    createUseDescriptionSection(rootElement);
280
                } else {
281
                    createTaxonDescriptionSection(rootElement);
282

    
283
                }
284
            }
285
        } else if (input instanceof DescriptionElementBase){
286
            Set<Marker> descriptionMarkers = new HashSet<>();
287
            if(((DescriptionElementBase) input).getInDescription()!=null) {
288
                descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
289
            }
290

    
291
            Boolean isUseDescription = false;
292
            for (Marker marker : descriptionMarkers) {
293
                if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
294
                    isUseDescription = true;
295
                }
296
            }
297

    
298
            if (isUseDescription == true && input instanceof CategoricalData) {
299
                createUseRecordSection(rootElement);
300
            } else {
301
                createDescriptionElementSection(rootElement);
302
            }
303

    
304
        } else if (input instanceof Media) {
305
            createMediaElementSection(rootElement);
306

    
307
        }
308
        //FIXME hack to show more informative message to the user when
309
        //DerivedUnit has more than one FieldUnit #4363
310
        else if (input.getClass().equals(DerivedUnit.class)) {
311
            DerivedUnit derivedUnit = (DerivedUnit)input;
312
            try {
313
                input = DerivedUnitFacade.NewInstance(derivedUnit,
314
                        PreferencesUtil.getDerivedUnitConfigurator());
315
            } catch (DerivedUnitFacadeNotSupportedException e) {
316
                createEmptySection(e.getMessage(), rootElement);
317
            }
318
        }
319
        else if (input instanceof DerivedUnitFacade) {
320
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
321
                if(((DerivedUnitFacade) input).innerFieldUnit()==null){
322
                    MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
323
                }
324
                else{
325
                    createFieldUnitSection(rootElement);
326
                }
327
            }
328
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
329
                if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
330
                    MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
331
                }
332
                else{
333
                    createDerivedUnitBaseElementSection(rootElement);
334
                }
335
            }
336
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
337
                //TissueSample should only be created by using it's own class
338
                //in future using only one class with different SpecimenOrObservationTypes is desired
339
                createTissueSampleSection(rootElement);
340
            }
341
            else{
342
                createDerivedUnitBaseElementSection(rootElement);
343
            }
344
        } else if (input instanceof DnaSample){
345
            DnaSample dnaSample = (DnaSample)input;
346
            if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
347
                createTissueSampleSection(rootElement);
348
            }
349
            else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
350
                createDnaSampleSection(rootElement);
351
            }
352
        } else if (input instanceof MediaSpecimen){
353
            createMediaSpecimenSection(rootElement);
354
        }
355
        else if(input instanceof Sequence){
356
            createSequenceSection(rootElement);
357
        }
358
        else if(input instanceof SingleRead){
359
            createSingleReadSection(rootElement);
360
        }
361
        else if (input instanceof FeatureNodeContainer) {
362
            createFeatureDistributionSection(rootElement);
363

    
364
        } else if (input instanceof FeatureNode) {
365
            createFeatureNodeSection(rootElement);
366

    
367
        } else if (input instanceof FeatureTree) {
368
            createFeatureTreeSection(rootElement);
369

    
370
        } else if (input instanceof Character) {
371
            createCharacterSection(rootElement);
372

    
373
        }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
374
            createPolytomousKeyNodeSection(rootElement);
375
        } else if (input instanceof User) {
376
            createUserSection(rootElement);
377
        } else if (input instanceof Group) {
378
            createGroupSection(rootElement);
379
        } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
380
                && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedNameOrInvalidDesignation())){
381
            createMisappliedNameSection(rootElement);
382
        }else if (input instanceof TaxonRelationship ) {
383
            createTaxonRelationshipSection(rootElement);
384
        } else if (input instanceof TermVocabulary) {
385
            createTermVocabularySection(rootElement);
386
        } else if (input instanceof DefinedTermBase) {
387
            createDefinedTermSection(rootElement);
388

    
389
        } else if (input instanceof SelectionChangedEvent ) {
390
            IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
391
            if (sel.getFirstElement()instanceof Distribution){
392
                createDescriptionElementSection(rootElement);
393
            }
394

    
395
            //            createDescriptionElementSection(rootElement);
396

    
397
        }else {
398
            createEmptySection(null, rootElement);
399
        }
400
        layout();
401

    
402
    }
403

    
404
    private void createGroupSection(RootElement parent) {
405
        destroySections();
406

    
407
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
408
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
409
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
410

    
411
        addPart(groupDetailSection);
412
        addPart(memberDetailSection);
413
        addPart(grantedAuthorityDetailSection);
414
    }
415

    
416
    /** {@inheritDoc} */
417
    @Override
418
    public ISelection getSelection() {
419
        return selection;
420
    }
421

    
422
    /** {@inheritDoc} */
423
    @Override
424
    public void setSelection(ISelection selection, boolean reveal) {
425

    
426
        this.selection = selection;
427

    
428
        if(this.selection!=null){
429
            SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
430
            fireSelectionChanged(selectionChangedEvent);
431
        }
432

    
433
    }
434

    
435
    private void createTaxonSections(RootElement parent) {
436
        ArrayList<AbstractFormSection> sections = new ArrayList<>();
437

    
438
        String id = "createTaxonSections";
439
        boolean sectionCached = isCached(id);
440

    
441
        if(!sectionCached){
442
            destroySections();
443

    
444
            ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
445
                    ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
446
            addPart(parsingMessagesSection);
447
            sections.add(parsingMessagesSection);
448

    
449
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
450
                TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
451
                        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
452
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
453
                addPart(taxonBaseDetailSection);
454
                sections.add(taxonBaseDetailSection);
455
            }else{
456
                if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
457
                    TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
458
                            ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
459
                    formFactory.createHorizontalSeparator(parent, SWT.BORDER);
460
                    addPart(taxonBaseDetailSection);
461
                    sections.add(taxonBaseDetailSection);
462
                }
463
            }
464
            NonViralNameDetailSection nonViralNameSection = formFactory
465
                    .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
466
                            ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
467
            addPart(nonViralNameSection);
468
            sections.add(nonViralNameSection);
469
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
470

    
471
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){
472
                NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
473
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
474
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
475
                addPart(referenceDetailSection);
476
                sections.add(referenceDetailSection);
477

    
478
            }
479
            if ( !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS))){
480
                NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
481
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
482
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
483
                addPart(nomenclaturalStatusSection);
484
                sections.add(nomenclaturalStatusSection);
485
            }
486

    
487
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){
488
                ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
489
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
490
                addPart(protologSection);
491
                sections.add(protologSection);
492
            }
493

    
494
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) &&  PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){
495
                TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
496
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
497
                addPart(typeDesignationSection);
498
                sections.add(typeDesignationSection);
499
            }
500

    
501
            if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){
502
                NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
503
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
504
                addPart(nameRelationshipSection);
505
                sections.add(nameRelationshipSection);
506
            }
507

    
508
            entityToSectionsMap.put(id, sections);
509
        }
510
    }
511

    
512
    private void createNameSections(RootElement parent) {
513
        destroySections();
514

    
515
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
516
                getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
517
                | ExpandableComposite.EXPANDED);
518

    
519
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
520

    
521
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
522
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
523
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
524

    
525
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
526
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
527
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
528

    
529
        addPart(nonViralNameSection);
530
        addPart(nomenclaturalStatusSection);
531
        addPart(referenceDetailSection);
532

    
533
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
534
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
535

    
536
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
537
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
538

    
539
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
540
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
541
        addPart(protologSection);
542
        addPart(typeDesignationSection);
543
        addPart(nameRelationshipSection);
544

    
545
    }
546

    
547
    private void createReferenceSections(RootElement parent) {
548
        destroySections();
549

    
550
        ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
551
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
552

    
553
        addPart(referenceDetailSection);
554
    }
555

    
556
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
557
        destroySections();
558

    
559
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
560

    
561
        addPart(teamOrPersonBaseDetailSection);
562
    }
563

    
564
    private void createTeamDetailSection(RootElement parent) {
565
        destroySections();
566

    
567
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
568

    
569
        addPart(teamDetailSection);
570
    }
571

    
572
    private void createPersonDetailSection(RootElement parent) {
573
        destroySections();
574

    
575
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
576
        addPart(personDetailSection);
577
    }
578

    
579
    private void createDescriptionElementSection(RootElement parent) {
580
        destroySections();
581

    
582
        DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
583
        descriptionElementDetailSection.setEnabled(this.detailsEnabled);
584

    
585
        //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
586

    
587
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
588

    
589
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
590

    
591
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
592

    
593
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
594

    
595
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
596

    
597
        addPart(descriptionElementDetailSection);
598
        addPart(descriptionElementSourceSection);
599
        addPart(descriptionElementMediaSection);
600
    }
601

    
602
    private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) {
603
        destroySections();
604

    
605
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
606
        addPart(descriptionDetailSection);
607

    
608
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
609

    
610
        if(isTaxonDescription) {
611
            NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
612
                    getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
613
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
614
            addPart(naturalLanguageSection);
615
        }
616
        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
617
                getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
618
        addPart(descriptionSourceSection);
619

    
620
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
621

    
622
        if(isTaxonDescription) {
623
            ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
624
            addPart(scopeSection);
625
        }
626
    }
627

    
628
    private void createTaxonDescriptionSection(RootElement parent) {
629
        destroySections();
630

    
631
        createDescriptionSection(parent, true);
632
    }
633

    
634
    private void createSpecimenDescriptionSection(RootElement parent) {
635
        destroySections();
636

    
637
        createDescriptionSection(parent, false);
638
    }
639

    
640
    private void createUseDescriptionSection(RootElement parent) {
641
        destroySections();
642

    
643
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
644

    
645
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
646

    
647
        DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
648

    
649
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
650

    
651
        addPart(descriptionDetailSection);
652
        addPart(descriptionSourceSection);
653

    
654
    }
655

    
656
    private void createImageGallerySection(RootElement parent) {
657
        destroySections();
658

    
659
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
660

    
661
        addPart(descriptionDetailSection);
662
    }
663

    
664
    private void createMediaElementSection(RootElement parent) {
665
        destroySections();
666

    
667
        MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
668

    
669
        addPart(mediaDetailSection);
670
    }
671

    
672
    private void createDerivedUnitBaseElementSection(RootElement parent) {
673
        ArrayList<AbstractFormSection> sections = new ArrayList<>();
674

    
675
        String id = "createDerivedUnitBaseElementSection";
676
        boolean sectionCached = isCached(id);
677
        if(!sectionCached){
678

    
679
            destroySections();
680

    
681
            DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
682
            //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
683
            //        if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
684
            derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
685
            //        }
686
            addPart(derivedUnitGeneralDetailSection);
687
            sections.add(derivedUnitGeneralDetailSection);
688

    
689

    
690
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691

    
692
            DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
693
            addPart(derivedUnitBaseDetailSection);
694
            sections.add(derivedUnitBaseDetailSection);
695

    
696
            //        //for editors working with facades
697
            //        if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
698
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
699
            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
700
            addPart(gatheringEventDetailSection);
701
            sections.add(gatheringEventDetailSection);
702

    
703
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
704
            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
705
            addPart(fieldUnitDetailSection);
706
            sections.add(fieldUnitDetailSection);
707
            //        }
708
            //        else{
709
            //
710
            if(PreferencesUtil.isShowTaxonAssociations()){
711
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
712
                TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
713
                addPart(taxonAssociationDetailSection);
714
                sections.add(taxonAssociationDetailSection);
715
            }
716
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
717
            DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
718
            addPart(identifierDetailSection);
719
            sections.add(identifierDetailSection);
720
            //    }
721
            if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
722
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
723
                DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
724
                addPart(determinationDetailSection);
725
                sections.add(determinationDetailSection);
726
            }
727

    
728
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
729
            DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
730
            addPart(derivedUnitTypeDesignationSection);
731
            sections.add(derivedUnitTypeDesignationSection);
732

    
733
            entityToSectionsMap.put(id, sections);
734
        }
735
    }
736

    
737
    private void createFieldUnitSection(RootElement parent) {
738
        destroySections();
739

    
740
        FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
741

    
742
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
743

    
744
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
745

    
746
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
747

    
748
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
749

    
750
        addPart(fielUnitGeneralDetailSection);
751
        addPart(gatheringEventDetailSection);
752
        addPart(fieldUnitDetailSection);
753

    
754
        if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
755
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
756
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
757
            addPart(determinationDetailSection);
758
        }
759
    }
760

    
761
    private void createTissueSampleSection(RootElement parent) {
762
        destroySections();
763

    
764
        TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
765

    
766
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
767

    
768
        SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
769

    
770
        addPart(section);
771
        addPart(sampleDesignationDetailSection);
772
    }
773

    
774
    private void createDnaSampleSection(RootElement parent) {
775
        destroySections();
776

    
777
        DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
778

    
779
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
780

    
781
        DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
782

    
783
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
784

    
785
        DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
786

    
787
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
788

    
789
        SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
790

    
791
        addPart(section);
792
        addPart(preparationPreservationSection);
793
        addPart(qualitySection);
794
        addPart(sampleDesignationDetailSection);
795
    }
796

    
797
    private void createSequenceSection(RootElement parent) {
798
        destroySections();
799

    
800
        SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
801

    
802
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
803

    
804
        SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
805

    
806
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
807

    
808
        SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
809

    
810

    
811
        addPart(section);
812
        addPart(referenceSection);
813
        addPart(contigFileSection);
814
    }
815

    
816
    private void createSingleReadSection(RootElement parent) {
817
        destroySections();
818

    
819
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
820
        addPart(section);
821

    
822
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
823

    
824
        SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
825
        addPart(pherogramSection);
826

    
827
    }
828

    
829
    private void createMediaSpecimenSection(RootElement parent) {
830
        destroySections();
831

    
832
        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
833
        addPart(generalSection);
834

    
835
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
836

    
837
        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
838
        addPart(rightsSection);
839

    
840
    }
841

    
842
    private void createFeatureTreeSection(RootElement parent) {
843
        destroySections();
844

    
845
        FeatureTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
846

    
847
        addPart(section);
848
    }
849

    
850
    private void createFeatureNodeSection(RootElement parent) {
851
        destroySections();
852

    
853
        FeatureNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
854

    
855
        addPart(featureDistributionSection);
856
    }
857

    
858
    private void createFeatureDistributionSection(RootElement parent) {
859
        destroySections();
860

    
861
        FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
862

    
863
        addPart(featureDistributionSection);
864
    }
865

    
866
    private void createCharacterSection(RootElement parent) {
867
        destroySections();
868

    
869
        CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
870

    
871
        addPart(featureDistributionSection);
872
    }
873

    
874
    private void createPolytomousKeyNodeSection(RootElement parent) {
875
        destroySections();
876

    
877
        PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
878

    
879
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
880

    
881
        PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
882

    
883
        addPart(polytomousKeyDetailSection);
884
        addPart(polytomousKeyNodeDetailSection);
885

    
886
    }
887

    
888
    private void createUseRecordSection(RootElement parent) {
889
        destroySections();
890

    
891
        UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
892

    
893
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
894

    
895
        addPart(descriptionUseRecordSection);
896

    
897

    
898
    }
899

    
900
    private void createUserSection(RootElement parent) {
901
        destroySections();
902

    
903
        UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
904

    
905
        GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
906

    
907
        addPart(userDetailSection);
908
        addPart(groupByUserDetailSection);
909
    }
910

    
911
    private void createMisappliedNameSection(RootElement parent) {
912
        destroySections();
913

    
914
        TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
915
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
916
        addPart(taxonRelationshipDetailSection);
917

    
918
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
919

    
920

    
921
        NonViralNameDetailSection nonViralNameSection = formFactory
922
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
923
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
924
        addPart(nonViralNameSection);
925

    
926
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
927

    
928
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
929
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
930
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
931
        addPart(referenceDetailSection);
932

    
933

    
934
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
935
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
936
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
937
        addPart(nomenclaturalStatusSection);
938

    
939
		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
940
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
941
		addPart(protologSection);
942

    
943
		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
944
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
945
		addPart(typeDesignationSection);
946

    
947
		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
948
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
949
		addPart(nameRelationshipSection);
950

    
951
    }
952

    
953
    private void createTaxonRelationshipSection(RootElement parent) {
954
        destroySections();
955

    
956
        TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
957

    
958
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
959
        addPart(taxonRelationshipDetailSection);
960
        addPart(referencedEntityBaseDetailSection);
961
    }
962
    private void createTermVocabularySection(RootElement parent) {
963
        destroySections();
964

    
965
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
966
        addPart(termVocabularyDetailSection);
967
    }
968

    
969
    private void createDefinedTermSection(RootElement parent) {
970
        destroySections();
971

    
972
        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
973
        addPart(definedTermDetailSection);
974
    }
975

    
976
    @Override
977
    public void update(CdmDataChangeMap arg0) {
978

    
979
    }
980

    
981
    @Inject
982
    @Optional
983
    private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_TAXON_DETAILS)boolean refresh){
984
        if(refresh){
985
            refresh();
986
        }
987
    }
988
}
(2-2/2)