Project

General

Profile

Download (41 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.detail;
11

    
12
import java.util.Set;
13

    
14
import org.eclipse.jface.viewers.ISelection;
15
import org.eclipse.jface.viewers.SelectionChangedEvent;
16
import org.eclipse.jface.viewers.TreeNode;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.ui.forms.widgets.ExpandableComposite;
20

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

    
117
/**
118
 *
119
 * The DetailsViewer handles the content of the details view (
120
 * {@link DetailsViewPart}).<br>
121
 * Depending on the type of the selected element the section of the details view
122
 * are created.
123
 *
124
 * @author n.hoffmann
125
 * @created Feb 12, 2010
126
 * @version 1.0
127
 */
128
public class DetailsViewer extends AbstractCdmDataViewer {
129

    
130
    private ISelection selection;
131
    
132
    public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
133
        super(parent, viewPart);
134
    }
135

    
136
    // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
137
    // since we are getting implementations of DerivedUnitBase from the bulk
138
    // editor
139
    // and not derived unit facade objects,
140

    
141
    @Override
142
    public void setInput(Object input) {
143
        if(input instanceof TreeNode){
144
            input = ((TreeNode) input).getValue();
145
        }
146
        if(input instanceof GbifResponse){
147
            input = ((GbifResponse) input).getDerivedUnitFacade();
148
        }
149
        if (input.getClass().equals(DerivedUnit.class)) {
150
            DerivedUnit derivedUnit = (DerivedUnit)input;
151
            try {
152
                input = DerivedUnitFacade.NewInstance(derivedUnit,
153
                        PreferencesUtil.getDerivedUnitConfigurator());
154
            } catch (DerivedUnitFacadeNotSupportedException e) {
155
//                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
156
            }
157
        }
158
        else if(input instanceof FieldUnit){
159
            input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
160
        }
161
        super.setInput(input);
162
    }
163

    
164
    @Override
165
    protected void markViewPartDirty() {
166
        if (getInput() instanceof DerivedUnitFacade) {
167
            DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
168
            if(facade.innerDerivedUnit()!=null){
169
                getViewPart().changed(facade.innerDerivedUnit());
170
            }
171
            else if(facade.innerFieldUnit()!=null){
172
                getViewPart().changed(facade.innerFieldUnit());
173
            }
174
        }
175
        else{
176
            super.markViewPartDirty();
177
        }
178
    }
179

    
180
    // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
181

    
182

    
183
    /** {@inheritDoc} */
184
    @Override
185
    protected void showParts() {
186
        // FIXME (CM) : Need to clean out this code.
187
        // Too much type checking to decide which detail view to display.
188
        // Need to build in a mechanism where navigators / editors are 'aware'
189
        // of the corresponding detail viewer.
190
        Object input = getInput();
191

    
192
        destroySections();
193
        if (input instanceof TaxonBase) {
194
            if(((TaxonBase) input).getName()==null){
195
                createEmptySection(rootElement);
196
            }
197
            else{
198
                createTaxonSections(rootElement);
199
            }
200

    
201
        } else if (input instanceof NonViralName) {
202
            createNameSections(rootElement);
203

    
204
        } else if (input instanceof Reference) {
205
            createReferenceSections(rootElement);
206

    
207
        } else if (input instanceof Team) {
208
            createTeamDetailSection(rootElement);
209

    
210
        } else if (input instanceof Person) {
211
            createPersonDetailSection(rootElement);
212

    
213
        } else if (input instanceof TeamOrPersonBase) {
214
            createTeamOrPersonBaseDetailSection(rootElement);
215

    
216
        } else if (input instanceof DescriptionBase) {
217
            if(input instanceof SpecimenDescription){
218
                //TODO: add more sections to DetailsView for SpecimenDescription
219
                createSpecimenDescriptionSection(rootElement);
220
            }
221
            else{
222
                Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
223

    
224
                Boolean isUseDescription = false;
225
                for (Marker marker : descriptionMarkers) {
226
                    if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
227
                        isUseDescription = true;
228
                    }
229
                }
230
                if (((DescriptionBase<?>) input).isImageGallery()) {
231
                    createImageGallerySection(rootElement);
232

    
233
                } else if (isUseDescription) {
234
                    createUseDescriptionSection(rootElement);
235
                } else {
236
                    createDescriptionSection(rootElement);
237

    
238
                }
239
            }
240
        } else if (input instanceof DescriptionElementBase) {
241
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
242

    
243
            Boolean isUseDescription = false;
244
            for (Marker marker : descriptionMarkers) {
245
                if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
246
                    isUseDescription = true;
247
                }
248
            }
249

    
250
            if (isUseDescription == true && input instanceof CategoricalData) {
251
                createUseRecordSection(rootElement);
252
            } else {
253
                createDescriptionElementSection(rootElement);
254
            }
255

    
256
        } else if (input instanceof Media) {
257
            createMediaElementSection(rootElement);
258

    
259
        } else if (input instanceof DerivedUnitFacade) {
260
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
261
                if(((DerivedUnitFacade) input).innerFieldUnit()==null){
262
                    MessagingUtils.error(DetailsViewer.class, "FieldUnit of facade is null", null);
263
                }
264
                else{
265
                    createFieldUnitSection(rootElement);
266
                }
267
            }
268
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
269
                if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
270
                    MessagingUtils.error(DetailsViewer.class, "DerivedUnit of facade is null", null);
271
                }
272
                else{
273
                    createDerivedUnitBaseElementSection(rootElement);
274
                }
275
            }
276
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
277
                //TissueSample should only be created by using it's own class
278
                //in future using only one class with different SpecimenOrObservationTypes is desired
279
                createTissueSampleSection(rootElement);
280
            }
281
            else{
282
                createDerivedUnitBaseElementSection(rootElement);
283
            }
284
        } else if (input instanceof DnaSample){
285
            DnaSample dnaSample = (DnaSample)input;
286
            if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
287
                createTissueSampleSection(rootElement);
288
            }
289
            else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
290
                createDnaSampleSection(rootElement);
291
            }
292
        } else if (input instanceof MediaSpecimen){
293
            createMediaSpecimenSection(rootElement);
294
        }
295
        else if(input instanceof Sequence){
296
            createSequenceSection(rootElement);
297
        }
298
        else if(input instanceof SingleRead){
299
            createSingleReadSection(rootElement);
300
        }
301
        else if (input instanceof FeatureNodeContainer) {
302
            createFeatureDistributionSection(rootElement);
303

    
304
        }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
305
            createPolytomousKeyNodeSection(rootElement);
306
        } else if (input instanceof User) {
307
            createUserSection(rootElement);
308
        } else if (input instanceof Group) {
309
            createGroupSection(rootElement);
310
        } else if (input instanceof TaxonRelationship) {
311
            createTaxonRelationshipSection(rootElement);
312
        } else if (input instanceof TermVocabulary) {
313
            createTermVocabularySection(rootElement);
314
        } else if (input instanceof DefinedTermBase) {
315
            createDefinedTermSection(rootElement);
316
        }
317
        else {
318
            createEmptySection(rootElement);
319
        }
320
        layout();
321
    }
322

    
323

    
324
    private void createEmptySection(RootElement parent) {
325
        destroySections();
326

    
327
        EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
328

    
329
        addPart(emptySection);
330
    }
331

    
332
    private void createGroupSection(RootElement parent) {
333
        destroySections();
334

    
335
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
336
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
337
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
338

    
339
        addPart(groupDetailSection);
340
        addPart(memberDetailSection);
341
        addPart(grantedAuthorityDetailSection);
342
    }
343

    
344
    /** {@inheritDoc} */
345
    @Override
346
    public ISelection getSelection() {
347
        return selection;
348
    }
349

    
350
    /** {@inheritDoc} */
351
    @Override
352
    public void setSelection(ISelection selection, boolean reveal) {
353
        this.selection = selection;
354
        if(this.selection!=null){
355
            SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
356
            fireSelectionChanged(selectionChangedEvent);
357
        }
358
    }
359

    
360
    private void createTaxonSections(RootElement parent) {
361
        destroySections();
362

    
363
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
364
                ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
365
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
366
        	TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
367
	        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
368
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
369
	        addPart(taxonBaseDetailSection);
370
        }else{
371
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
372
	            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
373
	            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
374
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
375
	
376
	            addPart(taxonBaseDetailSection);
377
        	}
378
        }
379
        NonViralNameDetailSection nonViralNameSection = formFactory
380
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
381
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
382
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
383
        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))){       
384
	            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
385
	            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
386
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
387
	            addPart(referenceDetailSection);
388
        	
389
        }
390
        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))){
391
	            NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
392
	            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
393
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
394
	            addPart(nomenclaturalStatusSection);
395
        }
396
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  ){
397
        	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))){
398
        		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
399
        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
400
        		addPart(protologSection);
401
        	}
402
        	
403
        	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))){
404
        		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
405
        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
406
        		addPart(typeDesignationSection);
407
        	}
408
        	
409
        	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))){
410
        		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
411
        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
412
        		addPart(nameRelationshipSection);
413
        	}
414
        }
415

    
416
        addPart(parsingMessagesSection);
417

    
418
        addPart(nonViralNameSection);
419

    
420
    }
421

    
422
    private void createNameSections(RootElement parent) {
423
        destroySections();
424
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
425
                getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
426
                        | ExpandableComposite.EXPANDED);
427
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
428

    
429
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
430
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
431
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
432

    
433
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
434
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
435
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
436

    
437
        addPart(nonViralNameSection);
438
        addPart(nomenclaturalStatusSection);
439
        addPart(referenceDetailSection);
440
//TODO RL
441
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
442
			ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
443
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
444

    
445
	        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
446
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
447

    
448
	        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
449
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
450
	        addPart(protologSection);
451
	        addPart(typeDesignationSection);
452
	        addPart(nameRelationshipSection);
453
        }
454
    }
455

    
456
    private void createReferenceSections(RootElement parent) {
457
        destroySections();
458

    
459
        ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
460
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
461

    
462
        addPart(referenceDetailSection);
463
    }
464

    
465
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
466
        destroySections();
467
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
468

    
469
        addPart(teamOrPersonBaseDetailSection);
470
    }
471

    
472
    private void createTeamDetailSection(RootElement parent) {
473
        destroySections();
474
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
475

    
476
        addPart(teamDetailSection);
477
    }
478

    
479
    private void createPersonDetailSection(RootElement parent) {
480
        destroySections();
481
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
482
        addPart(personDetailSection);
483
    }
484

    
485
    private void createDescriptionElementSection(RootElement parent) {
486
        destroySections();
487

    
488
        DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
489

    
490
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
491

    
492
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
493

    
494
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
495

    
496
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
497

    
498
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
499

    
500
        addPart(descriptionElementDetailSection);
501
        addPart(descriptionElementSourceSection);
502
        addPart(descriptionElementMediaSection);
503
    }
504

    
505
    private void createDescriptionSection(RootElement parent) {
506
        destroySections();
507
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
508

    
509
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
510

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

    
513
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
514

    
515
//        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
516
//
517
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
518

    
519
        //		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
520
        //				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
521
        //						getConversationHolder(), parent, Section.TWISTIE);
522
        //
523
        //		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
524

    
525
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
526

    
527
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
528

    
529
        addPart(descriptionDetailSection);
530
        addPart(naturalLanguageSection);
531
//        addPart(describedSpecimenSection);
532
        //		addPart(descriptionSourceSection);
533
        addPart(scopeSection);
534
    }
535

    
536
    private void createSpecimenDescriptionSection(RootElement parent) {
537
        destroySections();
538
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
539
        addPart(descriptionDetailSection);
540
    }
541

    
542
    private void createUseDescriptionSection(RootElement parent) {
543
        destroySections();
544
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
545

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

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

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

    
552
        addPart(descriptionDetailSection);
553
        addPart(descriptionSourceSection);
554

    
555
    }
556

    
557
    private void createImageGallerySection(RootElement parent) {
558
        destroySections();
559
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
560

    
561
        addPart(descriptionDetailSection);
562
    }
563

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

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

    
569
        addPart(mediaDetailSection);
570
    }
571

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

    
575
        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
576
        //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
577
        if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
578
            derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
579
        }
580
        addPart(derivedUnitGeneralDetailSection);
581

    
582
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
583

    
584
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
585
        addPart(derivedUnitBaseDetailSection);
586

    
587
        //for editors working with facades
588
        if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
589
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
590
            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
591
            addPart(gatheringEventDetailSection);
592

    
593
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
594
            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
595
            addPart(fieldUnitDetailSection);
596
        }
597
        else{
598

    
599
            if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
600
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
601
                TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
602
                addPart(taxonAssociationDetailSection);
603
            }
604
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
605
            DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
606
            addPart(identifierDetailSection);
607
        }
608
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
609
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
610
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
611
            addPart(determinationDetailSection);
612
        }
613

    
614
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
615
        DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
616
        addPart(derivedUnitTypeDesignationSection);
617

    
618
    }
619

    
620
    private void createFieldUnitSection(RootElement parent) {
621
        destroySections();
622

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

    
625
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
626

    
627
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
628

    
629
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
630

    
631
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
632

    
633
        addPart(fielUnitGeneralDetailSection);
634
        addPart(gatheringEventDetailSection);
635
        addPart(fieldUnitDetailSection);
636

    
637
        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
638
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
639
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
640
            addPart(determinationDetailSection);
641
        }
642
    }
643

    
644
    private void createTissueSampleSection(RootElement parent) {
645
        destroySections();
646

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

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

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

    
653
        addPart(section);
654
        addPart(sampleDesignationDetailSection);
655
    }
656

    
657
    private void createDnaSampleSection(RootElement parent) {
658
        destroySections();
659

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

    
662
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
663

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

    
666
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
667

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

    
670
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
671

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

    
674
        addPart(section);
675
        addPart(preparationPreservationSection);
676
        addPart(qualitySection);
677
        addPart(sampleDesignationDetailSection);
678
    }
679

    
680
    private void createSequenceSection(RootElement parent) {
681
        destroySections();
682

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

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

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

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

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

    
693

    
694
        addPart(section);
695
        addPart(referenceSection);
696
        addPart(contigFileSection);
697
    }
698

    
699
    private void createSingleReadSection(RootElement parent) {
700
        destroySections();
701

    
702
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
703
        addPart(section);
704

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

    
707
        SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
708
        addPart(pherogramSection);
709

    
710
    }
711

    
712
    private void createMediaSpecimenSection(RootElement parent) {
713
        destroySections();
714

    
715
        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
716
        addPart(generalSection);
717

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

    
720
        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
721
        addPart(rightsSection);
722

    
723
    }
724

    
725
    private void createFeatureDistributionSection(RootElement parent) {
726
        destroySections();
727

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

    
730
        addPart(featureDistributionSection);
731
    }
732

    
733
    private void createPolytomousKeyNodeSection(RootElement parent) {
734
        destroySections();
735

    
736
        PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
737

    
738
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
739

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

    
742
        addPart(polytomousKeyDetailSection);
743
        addPart(polytomousKeyNodeDetailSection);
744

    
745
    }
746

    
747
    private void createUseRecordSection(RootElement parent) {
748
        destroySections();
749

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

    
752
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
753

    
754
        addPart(descriptionUseRecordSection);
755

    
756

    
757
    }
758

    
759
    private void createUserSection(RootElement parent) {
760
        destroySections();
761

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

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

    
766
        addPart(userDetailSection);
767
        addPart(groupByUserDetailSection);
768
    }
769

    
770
    private void createTaxonRelationshipSection(RootElement parent) {
771
        destroySections();
772

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

    
775
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
776
        addPart(taxonRelationshipDetailSection);
777
        addPart(referencedEntityBaseDetailSection);
778
    }
779

    
780
    private void createTermVocabularySection(RootElement parent) {
781
        destroySections();
782

    
783
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
784
        addPart(termVocabularyDetailSection);
785
    }
786

    
787
    private void createDefinedTermSection(RootElement parent) {
788
        destroySections();
789

    
790
        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
791
        addPart(definedTermDetailSection);
792
    }
793

    
794
	@Override
795
	public void update(CdmDataChangeMap arg0) {
796
		
797
	}
798

    
799
}
(3-3/3)