Project

General

Profile

Download (46.7 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.HashSet;
13
import java.util.Set;
14

    
15
import javax.inject.Inject;
16

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

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

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

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

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

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

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

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

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

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

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

    
218
    /** {@inheritDoc} */
219
    @Override
220
    protected void showParts() {
221
        // FIXME (CM) : Need to clean out this code.
222
        // Too much type checking to decide which detail view to display.
223
        // Need to build in a mechanism where navigators / editors are 'aware'
224
        // of the corresponding detail viewer.
225

    
226
        Object input = getInput();
227

    
228
        destroySections();
229
        if (input instanceof TaxonBase) {
230
            if(((TaxonBase) input).getName()==null){
231
                createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
232
            }
233
            else{
234
                createTaxonSections(rootElement);
235
            }
236

    
237
        } else if (input instanceof TaxonName) {
238
            createNameSections(rootElement);
239

    
240
        } else if (input instanceof Reference) {
241
            createReferenceSections(rootElement);
242

    
243
        } else if (input instanceof Team) {
244
            createTeamDetailSection(rootElement);
245

    
246
        } else if (input instanceof Person) {
247
            createPersonDetailSection(rootElement);
248

    
249
        } else if (input instanceof TeamOrPersonBase) {
250
            createTeamOrPersonBaseDetailSection(rootElement);
251

    
252
        } else if (input instanceof DescriptionBase) {
253
            if(input instanceof SpecimenDescription){
254
                //TODO: add more sections to DetailsView for SpecimenDescription
255
                createSpecimenDescriptionSection(rootElement);
256
            }
257
            else{
258
                Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
259

    
260
                Boolean isUseDescription = false;
261
                for (Marker marker : descriptionMarkers) {
262
                    if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
263
                        isUseDescription = true;
264
                    }
265
                }
266
                if (((DescriptionBase<?>) input).isImageGallery()) {
267
                    createImageGallerySection(rootElement);
268

    
269
                } else if (isUseDescription) {
270
                    createUseDescriptionSection(rootElement);
271
                } else {
272
                    createDescriptionSection(rootElement);
273

    
274
                }
275
            }
276
        } else if (input instanceof DescriptionElementBase){
277
            Set<Marker> descriptionMarkers = new HashSet<>();
278
            if(((DescriptionElementBase) input).getInDescription()!=null) {
279
                descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
280
            }
281

    
282
            Boolean isUseDescription = false;
283
            for (Marker marker : descriptionMarkers) {
284
                if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
285
                    isUseDescription = true;
286
                }
287
            }
288

    
289
            if (isUseDescription == true && input instanceof CategoricalData) {
290
                createUseRecordSection(rootElement);
291
            } else {
292
                createDescriptionElementSection(rootElement);
293
            }
294

    
295
        } else if (input instanceof Media) {
296
            createMediaElementSection(rootElement);
297

    
298
        } else if (input instanceof DerivedUnitFacade) {
299
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
300
                if(((DerivedUnitFacade) input).innerFieldUnit()==null){
301
                    MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
302
                }
303
                else{
304
                    createFieldUnitSection(rootElement);
305
                }
306
            }
307
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
308
                if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
309
                    MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
310
                }
311
                else{
312
                    createDerivedUnitBaseElementSection(rootElement);
313
                }
314
            }
315
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
316
                //TissueSample should only be created by using it's own class
317
                //in future using only one class with different SpecimenOrObservationTypes is desired
318
                createTissueSampleSection(rootElement);
319
            }
320
            else{
321
                createDerivedUnitBaseElementSection(rootElement);
322
            }
323
        } else if (input instanceof DnaSample){
324
            DnaSample dnaSample = (DnaSample)input;
325
            if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
326
                createTissueSampleSection(rootElement);
327
            }
328
            else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
329
                createDnaSampleSection(rootElement);
330
            }
331
        } else if (input instanceof MediaSpecimen){
332
            createMediaSpecimenSection(rootElement);
333
        }
334
        else if(input instanceof Sequence){
335
            createSequenceSection(rootElement);
336
        }
337
        else if(input instanceof SingleRead){
338
            createSingleReadSection(rootElement);
339
        }
340
        else if (input instanceof FeatureNodeContainer) {
341
            createFeatureDistributionSection(rootElement);
342

    
343
        } else if (input instanceof FeatureNode) {
344
            createFeatureNodeSection(rootElement);
345

    
346
        } else if (input instanceof FeatureTree) {
347
            createFeatureTreeSection(rootElement);
348

    
349
        } else if (input instanceof Character) {
350
            createCharacterSection(rootElement);
351

    
352
        }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
353
            createPolytomousKeyNodeSection(rootElement);
354
        } else if (input instanceof User) {
355
            createUserSection(rootElement);
356
        } else if (input instanceof Group) {
357
            createGroupSection(rootElement);
358
        } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
359
                && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym())){
360
            createMisappliedNameSection(rootElement);
361
        }else if (input instanceof TaxonRelationship ) {
362
            createTaxonRelationshipSection(rootElement);
363
        } else if (input instanceof TermVocabulary) {
364
            createTermVocabularySection(rootElement);
365
        } else if (input instanceof DefinedTermBase) {
366
            createDefinedTermSection(rootElement);
367

    
368
        } else if (input instanceof SelectionChangedEvent ) {
369
            IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
370
            if (sel.getFirstElement()instanceof Distribution){
371
                createDescriptionElementSection(rootElement);
372
            }
373

    
374
//            createDescriptionElementSection(rootElement);
375

    
376
        }else {
377
            createEmptySection(null, rootElement);
378
        }
379
        layout();
380

    
381
    }
382

    
383
    private void createGroupSection(RootElement parent) {
384
        destroySections();
385

    
386
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
387
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
388
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
389

    
390
        addPart(groupDetailSection);
391
        addPart(memberDetailSection);
392
        addPart(grantedAuthorityDetailSection);
393
    }
394

    
395
    /** {@inheritDoc} */
396
    @Override
397
    public ISelection getSelection() {
398
        return selection;
399
    }
400

    
401
    /** {@inheritDoc} */
402
    @Override
403
    public void setSelection(ISelection selection, boolean reveal) {
404

    
405
        this.selection = selection;
406

    
407
        if(this.selection!=null){
408
            SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
409
            fireSelectionChanged(selectionChangedEvent);
410
        }
411

    
412
    }
413

    
414
    private void createTaxonSections(RootElement parent) {
415
        destroySections();
416

    
417
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
418
                ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
419
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
420
            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
421
                    ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
422
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
423
            addPart(taxonBaseDetailSection);
424
        }else{
425
            if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
426
                TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
427
                        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
428
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
429

    
430
                addPart(taxonBaseDetailSection);
431
            }
432
        }
433
        NonViralNameDetailSection nonViralNameSection = formFactory
434
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
435
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
436
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
437
        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))){
438
            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
439
                    ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
440
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
441
            addPart(referenceDetailSection);
442

    
443
        }
444
        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))){
445
            NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
446
                    ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
447
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
448
            addPart(nomenclaturalStatusSection);
449
        }
450

    
451
        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))){
452
            ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
453
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
454
            addPart(protologSection);
455
        }
456

    
457
        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))){
458
            TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
459
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
460
            addPart(typeDesignationSection);
461
        }
462

    
463
        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))){
464
            NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
465
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
466
            addPart(nameRelationshipSection);
467
        }
468

    
469

    
470
        addPart(parsingMessagesSection);
471

    
472
        addPart(nonViralNameSection);
473

    
474
    }
475

    
476
    private void createNameSections(RootElement parent) {
477
        destroySections();
478
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
479
                getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
480
                | ExpandableComposite.EXPANDED);
481

    
482
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
483

    
484
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
485
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
486
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
487

    
488
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
489
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
490
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
491

    
492
        addPart(nonViralNameSection);
493
        addPart(nomenclaturalStatusSection);
494
        addPart(referenceDetailSection);
495

    
496
        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
497
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
498

    
499
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
500
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
501

    
502
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
503
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
504
        addPart(protologSection);
505
        addPart(typeDesignationSection);
506
        addPart(nameRelationshipSection);
507

    
508
    }
509

    
510
    private void createReferenceSections(RootElement parent) {
511
        destroySections();
512

    
513
        ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
514
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
515

    
516
        addPart(referenceDetailSection);
517
    }
518

    
519
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
520
        destroySections();
521
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
522

    
523
        addPart(teamOrPersonBaseDetailSection);
524
    }
525

    
526
    private void createTeamDetailSection(RootElement parent) {
527
        destroySections();
528
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
529

    
530
        addPart(teamDetailSection);
531
    }
532

    
533
    private void createPersonDetailSection(RootElement parent) {
534
        destroySections();
535
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
536
        addPart(personDetailSection);
537
    }
538

    
539
    private void createDescriptionElementSection(RootElement parent) {
540

    
541
        destroySections();
542
        DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
543
        descriptionElementDetailSection.setEnabled(this.detailsEnabled);
544

    
545
        //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
546

    
547
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
548

    
549
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
550

    
551
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
552

    
553
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
554

    
555
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
556

    
557
        addPart(descriptionElementDetailSection);
558
        addPart(descriptionElementSourceSection);
559
        addPart(descriptionElementMediaSection);
560
    }
561

    
562
    private void createDescriptionSection(RootElement parent) {
563
        destroySections();
564
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
565

    
566
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
567

    
568
        NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
569

    
570
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
571

    
572
        //        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
573
        //
574
        //        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
575

    
576
        //		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
577
        //				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
578
        //						getConversationHolder(), parent, Section.TWISTIE);
579
        //
580
        //		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
581

    
582
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
583

    
584
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
585

    
586
        addPart(descriptionDetailSection);
587
        addPart(naturalLanguageSection);
588
        //        addPart(describedSpecimenSection);
589
        //		addPart(descriptionSourceSection);
590
        addPart(scopeSection);
591
    }
592

    
593
    private void createSpecimenDescriptionSection(RootElement parent) {
594
        destroySections();
595
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
596
        addPart(descriptionDetailSection);
597
    }
598

    
599
    private void createUseDescriptionSection(RootElement parent) {
600
        destroySections();
601
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
602

    
603
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
604

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

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

    
609
        addPart(descriptionDetailSection);
610
        addPart(descriptionSourceSection);
611

    
612
    }
613

    
614
    private void createImageGallerySection(RootElement parent) {
615
        destroySections();
616
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
617

    
618
        addPart(descriptionDetailSection);
619
    }
620

    
621
    private void createMediaElementSection(RootElement parent) {
622
        destroySections();
623

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

    
626
        addPart(mediaDetailSection);
627
    }
628

    
629
    private void createDerivedUnitBaseElementSection(RootElement parent) {
630
        destroySections();
631

    
632
        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
633
        //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
634
        if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
635
            derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
636
        }
637
        addPart(derivedUnitGeneralDetailSection);
638

    
639
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
640

    
641
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
642
        addPart(derivedUnitBaseDetailSection);
643

    
644
        //for editors working with facades
645
        if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
646
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
647
            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
648
            addPart(gatheringEventDetailSection);
649

    
650
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
651
            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
652
            addPart(fieldUnitDetailSection);
653
        }
654
        else{
655

    
656
            if(PreferencesUtil.isShowTaxonAssociations()){
657
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
658
                TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
659
                addPart(taxonAssociationDetailSection);
660
            }
661
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
662
            DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
663
            addPart(identifierDetailSection);
664
        }
665
        if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
666
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
667
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
668
            addPart(determinationDetailSection);
669
        }
670

    
671
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
672
        DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
673
        addPart(derivedUnitTypeDesignationSection);
674

    
675
    }
676

    
677
    private void createFieldUnitSection(RootElement parent) {
678
        destroySections();
679

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

    
682
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683

    
684
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
685

    
686
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
687

    
688
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
689

    
690
        addPart(fielUnitGeneralDetailSection);
691
        addPart(gatheringEventDetailSection);
692
        addPart(fieldUnitDetailSection);
693

    
694
        if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
695
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
696
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
697
            addPart(determinationDetailSection);
698
        }
699
    }
700

    
701
    private void createTissueSampleSection(RootElement parent) {
702
        destroySections();
703

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

    
706
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
707

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

    
710
        addPart(section);
711
        addPart(sampleDesignationDetailSection);
712
    }
713

    
714
    private void createDnaSampleSection(RootElement parent) {
715
        destroySections();
716

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

    
719
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
720

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

    
723
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
724

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

    
727
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
728

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

    
731
        addPart(section);
732
        addPart(preparationPreservationSection);
733
        addPart(qualitySection);
734
        addPart(sampleDesignationDetailSection);
735
    }
736

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

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

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

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

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

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

    
750

    
751
        addPart(section);
752
        addPart(referenceSection);
753
        addPart(contigFileSection);
754
    }
755

    
756
    private void createSingleReadSection(RootElement parent) {
757
        destroySections();
758

    
759
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
760
        addPart(section);
761

    
762
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
763

    
764
        SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
765
        addPart(pherogramSection);
766

    
767
    }
768

    
769
    private void createMediaSpecimenSection(RootElement parent) {
770
        destroySections();
771

    
772
        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
773
        addPart(generalSection);
774

    
775
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
776

    
777
        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
778
        addPart(rightsSection);
779

    
780
    }
781

    
782
    private void createFeatureTreeSection(RootElement parent) {
783
        destroySections();
784

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

    
787
        addPart(section);
788
    }
789

    
790
    private void createFeatureNodeSection(RootElement parent) {
791
        destroySections();
792

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

    
795
        addPart(featureDistributionSection);
796
    }
797

    
798
    private void createFeatureDistributionSection(RootElement parent) {
799
        destroySections();
800

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

    
803
        addPart(featureDistributionSection);
804
    }
805

    
806
    private void createCharacterSection(RootElement parent) {
807
        destroySections();
808

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

    
811
        addPart(featureDistributionSection);
812
    }
813

    
814
    private void createPolytomousKeyNodeSection(RootElement parent) {
815
        destroySections();
816

    
817
        PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
818

    
819
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
820

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

    
823
        addPart(polytomousKeyDetailSection);
824
        addPart(polytomousKeyNodeDetailSection);
825

    
826
    }
827

    
828
    private void createUseRecordSection(RootElement parent) {
829
        destroySections();
830

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

    
833
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
834

    
835
        addPart(descriptionUseRecordSection);
836

    
837

    
838
    }
839

    
840
    private void createUserSection(RootElement parent) {
841
        destroySections();
842

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

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

    
847
        addPart(userDetailSection);
848
        addPart(groupByUserDetailSection);
849
    }
850

    
851
    private void createMisappliedNameSection(RootElement parent) {
852
        destroySections();
853

    
854
        TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
855
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
856
        addPart(taxonRelationshipDetailSection);
857

    
858
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
859

    
860

    
861
        NonViralNameDetailSection nonViralNameSection = formFactory
862
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
863
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
864
        addPart(nonViralNameSection);
865

    
866
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
867

    
868
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
869
                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
870
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
871
        addPart(referenceDetailSection);
872

    
873

    
874
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
875
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
876
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
877
        addPart(nomenclaturalStatusSection);
878

    
879
		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
880
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
881
		addPart(protologSection);
882

    
883
		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
884
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
885
		addPart(typeDesignationSection);
886

    
887
		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
888
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
889
		addPart(nameRelationshipSection);
890

    
891
    }
892

    
893
    private void createTaxonRelationshipSection(RootElement parent) {
894
        destroySections();
895

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

    
898
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
899
        addPart(taxonRelationshipDetailSection);
900
        addPart(referencedEntityBaseDetailSection);
901
    }
902
    private void createTermVocabularySection(RootElement parent) {
903
        destroySections();
904

    
905
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
906
        addPart(termVocabularyDetailSection);
907
    }
908

    
909
    private void createDefinedTermSection(RootElement parent) {
910
        destroySections();
911

    
912
        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
913
        addPart(definedTermDetailSection);
914
    }
915

    
916
    @Override
917
    public void update(CdmDataChangeMap arg0) {
918

    
919
    }
920
    @Inject
921
    @Optional
922
    private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_TAXON_DETAILS)boolean refresh){
923
        if(refresh){
924
            refresh();
925

    
926
//            setSelection(getSelection(), true);
927
        }
928
    }
929
}
(2-2/2)