Project

General

Profile

Revision 92568738

ID9256873819d1c0329726a93e4204597b6fb7dc28
Parent 1f83b218
Child 5062284f

Added by Patrick Plitzner about 2 years ago

ref #6597 Prototye for migrated details view

View differences:

eu.etaxonomy.taxeditor.store/fragment.e4xmi
19 19
        </children>
20 20
      </menus>
21 21
    </elements>
22
    <elements xsi:type="basic:PartDescriptor" xmi:id="_zTXhUGvBEeeNmdqhxF1CnA" elementId="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4" label="Details View" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4">
23
      <tags>nonRestore</tags>
24
    </elements>
22 25
  </fragments>
23 26
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_3rW8wCXaEeex9MwMOgUeWw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:bulkeditor.menus.openmenu">
24 27
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_K6sowCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.details" label="%command.label.0" command="_bnVKsCZxEeeQLpuomSmVoQ">
......
40 43
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_W-C-gCaJEeeTEd_pKXBflg" coreExpressionId="isCdmStoreConnected"/>
41 44
      <parameters xmi:id="_BylIUCZzEeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"/>
42 45
    </elements>
46
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_5AW5UGvBEeeNmdqhxF1CnA" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.sessions" label="Details" command="_bnVKsCZxEeeQLpuomSmVoQ">
47
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_5AXgYGvBEeeNmdqhxF1CnA" coreExpressionId="isCdmStoreConnected"/>
48
      <parameters xmi:id="_5AXgYWvBEeeNmdqhxF1CnA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4"/>
49
    </elements>
43 50
  </fragments>
44 51
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_mPdAcGceEee0qLTtA2ZpVQ" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
45 52
    <elements xsi:type="commands:Command" xmi:id="_oftL0GceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.addFeature" commandName="Add Feature" description="Add a feature to the feature tree"/>
eu.etaxonomy.taxeditor.store/plugin.xml
281 281
        restorable="true">
282 282
  </view>
283 283
  <view
284
        allowMultiple="false"
285
        class="eu.etaxonomy.taxeditor.view.detail.DetailsViewPart"
286
        icon="icons/accessories-text-editor.png"
287
        id="eu.etaxonomy.taxeditor.view.detail"
288
        name="%view.name.4"
289
        restorable="true">
290
  </view>
291
  <view
292 284
        class="eu.etaxonomy.taxeditor.view.userecords.UseRecordsViewPart"
293 285
        icon="icons/leaf_detail.png"
294 286
        id="eu.etaxonomy.taxeditor.view.userecords"
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/AbstractCdmDataViewerE4.java
1
/**
2
* Copyright (C) 2007 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 org.eclipse.jface.viewers.StructuredSelection;
13
import org.eclipse.jface.viewers.Viewer;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.Display;
17
import org.eclipse.ui.forms.IFormPart;
18
import org.eclipse.ui.forms.ManagedForm;
19
import org.eclipse.ui.forms.widgets.ScrolledForm;
20

  
21
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
22
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
23
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
24
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
25
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
26
import eu.etaxonomy.taxeditor.ui.element.RootElement;
27
import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
28

  
29
/**
30
 *
31
 * @author pplitzner
32
 * @date 18.07.2017
33
 *
34
 */
35
public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConversationEnabled{
36

  
37
	protected ManagedForm managedForm;
38

  
39
	protected CdmFormFactory formFactory;
40

  
41
	protected ScrolledForm scrolledForm;
42

  
43
	private final Composite body;
44

  
45
	protected RootElement rootElement;
46

  
47
	//TODO: create a super class for this?
48
	private Object input;
49

  
50

  
51
	public AbstractCdmDataViewerE4(Composite parent) {
52

  
53
		managedForm = new ManagedForm(parent){
54

  
55
			@Override
56
			public void dirtyStateChanged() {
57
			}
58
		};
59

  
60
		createFormFactory();
61

  
62
		scrolledForm = managedForm.getForm();
63

  
64
		body = scrolledForm.getBody();
65

  
66
		body.setLayout(LayoutConstants.LAYOUT());
67

  
68
		rootElement = new RootElement(formFactory, body);
69
	}
70

  
71
	protected void createFormFactory() {
72
		if(formFactory != null){
73
			formFactory.dispose();
74
			formFactory = null;
75
		}
76
		formFactory = new CdmFormFactory(Display.getCurrent(), this);
77
	}
78

  
79
	/** {@inheritDoc} */
80
	@Override
81
	public Control getControl() {
82
		if(body.isDisposed()){
83
			return null;
84
		}
85
		for(Control child : body.getChildren()){
86
			return child;
87
		}
88

  
89
		return body;
90
	}
91

  
92
	/** {@inheritDoc} */
93
	@Override
94
	public void setInput(Object input) {
95
		this.input = input;
96
		// reset selection
97
		setSelection(new StructuredSelection(input));
98
		refresh();
99
	}
100

  
101
	/** {@inheritDoc} */
102
	@Override
103
	public Object getInput() {
104
		return input;
105
	}
106

  
107
	/** {@inheritDoc} */
108
	@Override
109
	public void refresh() {
110
		showParts();
111

  
112
		managedForm.setInput(input);
113

  
114
		managedForm.refresh();
115

  
116
		managedForm.reflow(true);
117
	}
118

  
119
	public void layout(){
120
		body.layout();
121
	}
122

  
123
	protected abstract void showParts();
124

  
125
	protected void destroySections() {
126
		for (IFormPart formPart : managedForm.getParts()){
127
			removePart((CdmSectionPart<?>) formPart);
128
		}
129

  
130
		managedForm.setInput(null);
131

  
132
		formFactory.destroyElement(rootElement);
133

  
134
		createFormFactory();
135

  
136
		rootElement = new RootElement(formFactory, body);
137

  
138
		for(Control control : body.getChildren()){
139
			control.dispose();
140
			control = null;
141
		}
142
	}
143

  
144
	public void setFocus(){
145
		// we have to set focus to a control of this viewer
146
		// otherwise, after opening a dialog from the details, the focus will not be
147
		// given back to the details view but to the editor
148
		for(Control child : body.getChildren()){
149
			child.setFocus();
150
			break;
151
		}
152
	}
153

  
154
	public void reflow(){
155
		managedForm.reflow(true);
156
	}
157

  
158
	protected void removePart(CdmSectionPart<?> sectionPart){
159
		managedForm.removePart(sectionPart);
160
		formFactory.removePropertyChangeListener(sectionPart);
161
	}
162

  
163
	protected void addPart(AbstractFormSection<?> section){
164
		CdmSectionPart<?> sectionPart = new CdmSectionPart<>(section);
165
		managedForm.addPart(sectionPart);
166
		formFactory.addPropertyChangeListener(sectionPart);
167
	}
168

  
169
    @Override
170
    public ConversationHolder getConversationHolder() {
171
        return null;
172
	}
173

  
174
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.view.e4.details;
11

  
12
import javax.annotation.PostConstruct;
13
import javax.annotation.PreDestroy;
14
import javax.inject.Inject;
15
import javax.inject.Named;
16

  
17
import org.eclipse.e4.core.di.annotations.Optional;
18
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
19
import org.eclipse.e4.ui.services.IServiceConstants;
20
import org.eclipse.jface.viewers.IStructuredSelection;
21
import org.eclipse.jface.viewers.Viewer;
22
import org.eclipse.swt.widgets.Composite;
23

  
24
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
25
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
26
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
27
import eu.etaxonomy.taxeditor.l10n.Messages;
28

  
29
/**
30
 * @author pplitzner
31
 * @date 18.07.2017
32
 *
33
 */
34
public class DetailsPartE4 implements IConversationEnabled{
35

  
36
    private DetailsViewerE4 viewer;
37

  
38
    @Inject
39
    public DetailsPartE4() {
40
    }
41

  
42
    @PostConstruct
43
    public void create(Composite parent) {
44
        viewer = new DetailsViewerE4(parent);
45
    }
46

  
47
    @Inject
48
    @Optional
49
    public void selectionChanged(
50
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
51
            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
52
            MPart thisPart){
53
        showViewer(selection, activePart, thisPart);
54
    }
55

  
56
    protected String getViewName(){
57
        return Messages.DetailsViewPart_VIEWER_NAME;
58
    }
59

  
60
    public Viewer getViewer() {
61
        return viewer;
62
    }
63

  
64

  
65
    @PreDestroy
66
    public void dispose() {
67
    }
68

  
69
    public void showViewer(IStructuredSelection selection, MPart activePart, MPart thisPart){
70
        if(getViewer()!=null){
71
            Object element = selection.getFirstElement();
72
            if(selection.getFirstElement()!=null){
73
                getViewer().setInput(element);
74
            }
75
        }
76
    }
77

  
78
    /**
79
     * {@inheritDoc}
80
     */
81
    @Override
82
    public void update(CdmDataChangeMap arg0) {
83
        // TODO Auto-generated method stub
84

  
85
    }
86

  
87
    /**
88
     * {@inheritDoc}
89
     */
90
    @Override
91
    public ConversationHolder getConversationHolder() {
92
        return null;
93
    }
94
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
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.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.TaxonName;
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.model.taxon.TaxonRelationshipType;
50
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
51
import eu.etaxonomy.taxeditor.model.AbstractUtility;
52
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
53
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
54
import eu.etaxonomy.taxeditor.model.MessagingUtils;
55
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
56
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
57
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
58
import eu.etaxonomy.taxeditor.store.UsageTermCollection;
59
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
60
import eu.etaxonomy.taxeditor.ui.element.RootElement;
61
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
62
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
63
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
64
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
65
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
66
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
67
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
68
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
69
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
70
import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
71
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
72
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
73
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
74
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
75
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
76
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
77
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
78
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
79
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
80
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
81
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
82
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
83
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
84
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
85
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
86
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
87
import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
88
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
89
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
90
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
91
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
92
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
93
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
94
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
95
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
96
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
97
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
98
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
99
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
100
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
101
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
102
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
103
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
104
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
105
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
106
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
107
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
108
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
109
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
110
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
111
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
112
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
113
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
114
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
115
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
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 pplitzner
125
 * @date 18.07.2017
126
 *
127
 */
128
public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
129

  
130
    private ISelection selection;
131

  
132
    public DetailsViewerE4(Composite parent) {
133
        super(parent);
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

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

  
165

  
166
    /** {@inheritDoc} */
167
    @Override
168
    protected void showParts() {
169
        // FIXME (CM) : Need to clean out this code.
170
        // Too much type checking to decide which detail view to display.
171
        // Need to build in a mechanism where navigators / editors are 'aware'
172
        // of the corresponding detail viewer.
173

  
174
        Object input = getInput();
175

  
176
        destroySections();
177
        if (input instanceof TaxonBase) {
178
            if(((TaxonBase) input).getName()==null){
179
                createEmptySection(rootElement);
180
            }
181
            else{
182
                createTaxonSections(rootElement);
183
            }
184

  
185
        } else if (input instanceof TaxonName) {
186
            createNameSections(rootElement);
187

  
188
        } else if (input instanceof Reference) {
189
            createReferenceSections(rootElement);
190

  
191
        } else if (input instanceof Team) {
192
            createTeamDetailSection(rootElement);
193

  
194
        } else if (input instanceof Person) {
195
            createPersonDetailSection(rootElement);
196

  
197
        } else if (input instanceof TeamOrPersonBase) {
198
            createTeamOrPersonBaseDetailSection(rootElement);
199

  
200
        } else if (input instanceof DescriptionBase) {
201
            if(input instanceof SpecimenDescription){
202
                //TODO: add more sections to DetailsView for SpecimenDescription
203
                createSpecimenDescriptionSection(rootElement);
204
            }
205
            else{
206
                Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
207

  
208
                Boolean isUseDescription = false;
209
                for (Marker marker : descriptionMarkers) {
210
                    if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
211
                        isUseDescription = true;
212
                    }
213
                }
214
                if (((DescriptionBase<?>) input).isImageGallery()) {
215
                    createImageGallerySection(rootElement);
216

  
217
                } else if (isUseDescription) {
218
                    createUseDescriptionSection(rootElement);
219
                } else {
220
                    createDescriptionSection(rootElement);
221

  
222
                }
223
            }
224
        } else if (input instanceof DescriptionElementBase) {
225
            Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
226

  
227
            Boolean isUseDescription = false;
228
            for (Marker marker : descriptionMarkers) {
229
                if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
230
                    isUseDescription = true;
231
                }
232
            }
233

  
234
            if (isUseDescription == true && input instanceof CategoricalData) {
235
                createUseRecordSection(rootElement);
236
            } else {
237
                createDescriptionElementSection(rootElement);
238
            }
239

  
240
        } else if (input instanceof Media) {
241
            createMediaElementSection(rootElement);
242

  
243
        } else if (input instanceof DerivedUnitFacade) {
244
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
245
                if(((DerivedUnitFacade) input).innerFieldUnit()==null){
246
                    MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null);
247
                }
248
                else{
249
                    createFieldUnitSection(rootElement);
250
                }
251
            }
252
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
253
                if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
254
                    MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null);
255
                }
256
                else{
257
                    createDerivedUnitBaseElementSection(rootElement);
258
                }
259
            }
260
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
261
                //TissueSample should only be created by using it's own class
262
                //in future using only one class with different SpecimenOrObservationTypes is desired
263
                createTissueSampleSection(rootElement);
264
            }
265
            else{
266
                createDerivedUnitBaseElementSection(rootElement);
267
            }
268
        } else if (input instanceof DnaSample){
269
            DnaSample dnaSample = (DnaSample)input;
270
            if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
271
                createTissueSampleSection(rootElement);
272
            }
273
            else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
274
                createDnaSampleSection(rootElement);
275
            }
276
        } else if (input instanceof MediaSpecimen){
277
            createMediaSpecimenSection(rootElement);
278
        }
279
        else if(input instanceof Sequence){
280
            createSequenceSection(rootElement);
281
        }
282
        else if(input instanceof SingleRead){
283
            createSingleReadSection(rootElement);
284
        }
285
        else if (input instanceof FeatureNodeContainer) {
286
            createFeatureDistributionSection(rootElement);
287

  
288
        }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
289
            createPolytomousKeyNodeSection(rootElement);
290
        } else if (input instanceof User) {
291
            createUserSection(rootElement);
292
        } else if (input instanceof Group) {
293
            createGroupSection(rootElement);
294
        } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {
295
            createMisappliedNameSection(rootElement);
296
        }else if (input instanceof TaxonRelationship ) {
297
            createTaxonRelationshipSection(rootElement);
298
        } else if (input instanceof TermVocabulary) {
299
            createTermVocabularySection(rootElement);
300
        } else if (input instanceof DefinedTermBase) {
301
            createDefinedTermSection(rootElement);
302
        }
303
        else {
304
            createEmptySection(rootElement);
305
        }
306
        layout();
307

  
308
    }
309

  
310

  
311
    private void createEmptySection(RootElement parent) {
312
        destroySections();
313

  
314
        EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
315

  
316
        addPart(emptySection);
317
    }
318

  
319
    private void createGroupSection(RootElement parent) {
320
        destroySections();
321

  
322
        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
323
        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
324
        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
325

  
326
        addPart(groupDetailSection);
327
        addPart(memberDetailSection);
328
        addPart(grantedAuthorityDetailSection);
329
    }
330

  
331
    /** {@inheritDoc} */
332
    @Override
333
    public ISelection getSelection() {
334
        return selection;
335
    }
336

  
337
    /** {@inheritDoc} */
338
    @Override
339
    public void setSelection(ISelection selection, boolean reveal) {
340

  
341
    		this.selection = selection;
342

  
343
	        if(this.selection!=null){
344
	            SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
345
	            fireSelectionChanged(selectionChangedEvent);
346
	        }
347

  
348
    }
349

  
350
    private void createTaxonSections(RootElement parent) {
351
        destroySections();
352

  
353
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
354
                ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
355
        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
356
        	TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
357
	        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
358
	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
359
	        addPart(taxonBaseDetailSection);
360
        }else{
361
        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
362
	            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
363
	            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
364
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
365

  
366
	            addPart(taxonBaseDetailSection);
367
        	}
368
        }
369
        NonViralNameDetailSection nonViralNameSection = formFactory
370
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
371
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
372
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
373
        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))){
374
	            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
375
	            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
376
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
377
	            addPart(referenceDetailSection);
378

  
379
        }
380
        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))){
381
	            NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
382
	            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
383
	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
384
	            addPart(nomenclaturalStatusSection);
385
        }
386

  
387
    	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))){
388
    		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
389
    		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
390
    		addPart(protologSection);
391
    	}
392

  
393
    	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))){
394
    		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
395
    		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
396
    		addPart(typeDesignationSection);
397
    	}
398

  
399
    	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))){
400
    		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
401
    		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
402
    		addPart(nameRelationshipSection);
403
    	}
404

  
405

  
406
        addPart(parsingMessagesSection);
407

  
408
        addPart(nonViralNameSection);
409

  
410
    }
411

  
412
    private void createNameSections(RootElement parent) {
413
        destroySections();
414
        NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
415
                getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
416
                        | ExpandableComposite.EXPANDED);
417
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
418

  
419
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
420
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
421
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
422

  
423
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
424
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
425
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
426

  
427
        addPart(nonViralNameSection);
428
        addPart(nomenclaturalStatusSection);
429
        addPart(referenceDetailSection);
430

  
431
		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
432
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
433

  
434
        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
435
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
436

  
437
        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
438
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
439
        addPart(protologSection);
440
        addPart(typeDesignationSection);
441
        addPart(nameRelationshipSection);
442

  
443
    }
444

  
445
    private void createReferenceSections(RootElement parent) {
446
        destroySections();
447

  
448
        ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
449
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
450

  
451
        addPart(referenceDetailSection);
452
    }
453

  
454
    private void createTeamOrPersonBaseDetailSection(RootElement parent) {
455
        destroySections();
456
        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
457

  
458
        addPart(teamOrPersonBaseDetailSection);
459
    }
460

  
461
    private void createTeamDetailSection(RootElement parent) {
462
        destroySections();
463
        TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
464

  
465
        addPart(teamDetailSection);
466
    }
467

  
468
    private void createPersonDetailSection(RootElement parent) {
469
        destroySections();
470
        PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
471
        addPart(personDetailSection);
472
    }
473

  
474
    private void createDescriptionElementSection(RootElement parent) {
475
        destroySections();
476

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

  
479
      //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
480

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

  
483
        DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
484

  
485
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
486

  
487
        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
488

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

  
491
        addPart(descriptionElementDetailSection);
492
        addPart(descriptionElementSourceSection);
493
        addPart(descriptionElementMediaSection);
494
    }
495

  
496
    private void createDescriptionSection(RootElement parent) {
497
        destroySections();
498
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
499

  
500
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
501

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

  
504
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
505

  
506
//        DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
507
//
508
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
509

  
510
        //		DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
511
        //				.createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
512
        //						getConversationHolder(), parent, Section.TWISTIE);
513
        //
514
        //		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
515

  
516
        ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
517

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

  
520
        addPart(descriptionDetailSection);
521
        addPart(naturalLanguageSection);
522
//        addPart(describedSpecimenSection);
523
        //		addPart(descriptionSourceSection);
524
        addPart(scopeSection);
525
    }
526

  
527
    private void createSpecimenDescriptionSection(RootElement parent) {
528
        destroySections();
529
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
530
        addPart(descriptionDetailSection);
531
    }
532

  
533
    private void createUseDescriptionSection(RootElement parent) {
534
        destroySections();
535
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
536

  
537
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
538

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

  
541
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
542

  
543
        addPart(descriptionDetailSection);
544
        addPart(descriptionSourceSection);
545

  
546
    }
547

  
548
    private void createImageGallerySection(RootElement parent) {
549
        destroySections();
550
        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
551

  
552
        addPart(descriptionDetailSection);
553
    }
554

  
555
    private void createMediaElementSection(RootElement parent) {
556
        destroySections();
557

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

  
560
        addPart(mediaDetailSection);
561
    }
562

  
563
    private void createDerivedUnitBaseElementSection(RootElement parent) {
564
        destroySections();
565

  
566
        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
567
        //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
568
        if(!(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart)){
569
            derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
570
        }
571
        addPart(derivedUnitGeneralDetailSection);
572

  
573
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
574

  
575
        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
576
        addPart(derivedUnitBaseDetailSection);
577

  
578
        //for editors working with facades
579
        if(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart){
580
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
581
            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
582
            addPart(gatheringEventDetailSection);
583

  
584
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
585
            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
586
            addPart(fieldUnitDetailSection);
587
        }
588
        else{
589

  
590
            if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
591
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
592
                TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
593
                addPart(taxonAssociationDetailSection);
594
            }
595
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
596
            DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
597
            addPart(identifierDetailSection);
598
        }
599
        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
600
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
601
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
602
            addPart(determinationDetailSection);
603
        }
604

  
605
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
606
        DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
607
        addPart(derivedUnitTypeDesignationSection);
608

  
609
    }
610

  
611
    private void createFieldUnitSection(RootElement parent) {
612
        destroySections();
613

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

  
616
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
617

  
618
        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
619

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

  
622
        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
623

  
624
        addPart(fielUnitGeneralDetailSection);
625
        addPart(gatheringEventDetailSection);
626
        addPart(fieldUnitDetailSection);
627

  
628
        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
629
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
630
            DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
631
            addPart(determinationDetailSection);
632
        }
633
    }
634

  
635
    private void createTissueSampleSection(RootElement parent) {
636
        destroySections();
637

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

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

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

  
644
        addPart(section);
645
        addPart(sampleDesignationDetailSection);
646
    }
647

  
648
    private void createDnaSampleSection(RootElement parent) {
649
        destroySections();
650

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

  
653
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
654

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

  
657
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
658

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

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

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

  
665
        addPart(section);
666
        addPart(preparationPreservationSection);
667
        addPart(qualitySection);
668
        addPart(sampleDesignationDetailSection);
669
    }
670

  
671
    private void createSequenceSection(RootElement parent) {
672
        destroySections();
673

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

  
676
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
677

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

  
680
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
681

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

  
684

  
685
        addPart(section);
686
        addPart(referenceSection);
687
        addPart(contigFileSection);
688
    }
689

  
690
    private void createSingleReadSection(RootElement parent) {
691
        destroySections();
692

  
693
        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
694
        addPart(section);
695

  
696
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
697

  
698
        SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
699
        addPart(pherogramSection);
700

  
701
    }
702

  
703
    private void createMediaSpecimenSection(RootElement parent) {
704
        destroySections();
705

  
706
        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
707
        addPart(generalSection);
708

  
709
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
710

  
711
        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
712
        addPart(rightsSection);
713

  
714
    }
715

  
716
    private void createFeatureDistributionSection(RootElement parent) {
717
        destroySections();
718

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

  
721
        addPart(featureDistributionSection);
722
    }
723

  
724
    private void createPolytomousKeyNodeSection(RootElement parent) {
725
        destroySections();
726

  
727
        PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
728

  
729
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
730

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

  
733
        addPart(polytomousKeyDetailSection);
734
        addPart(polytomousKeyNodeDetailSection);
735

  
736
    }
737

  
738
    private void createUseRecordSection(RootElement parent) {
739
        destroySections();
740

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

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

  
745
        addPart(descriptionUseRecordSection);
746

  
747

  
748
    }
749

  
750
    private void createUserSection(RootElement parent) {
751
        destroySections();
752

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

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

  
757
        addPart(userDetailSection);
758
        addPart(groupByUserDetailSection);
759
    }
760

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

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

  
766
       // ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
767
        addPart(taxonRelationshipDetailSection);
768
        //addPart(referencedEntityBaseDetailSection);
769

  
770
        NonViralNameDetailSection nonViralNameSection = formFactory
771
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
772
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
773
        addPart(nonViralNameSection);
774
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
775
        //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))){
776
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
777
        		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
778
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
779
        addPart(referenceDetailSection);
780

  
781
        //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))){
782
            NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
783
            		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
784
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
785
            addPart(nomenclaturalStatusSection);
786
    //}
787

  
788
	//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))){
789
		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
790
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
791
		addPart(protologSection);
792
	//}
793

  
794
	//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))){
795
		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
796
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
797
		addPart(typeDesignationSection);
798
	//}
799

  
800
	//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))){
801
		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
802
		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
803
		addPart(nameRelationshipSection);
804
	//}
805

  
806

  
807
        //}
808
    }
809

  
810
    private void createTaxonRelationshipSection(RootElement parent) {
811
    	destroySections();
812

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

  
815
        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
816
        addPart(taxonRelationshipDetailSection);
817
        addPart(referencedEntityBaseDetailSection);
818
    }
819
    private void createTermVocabularySection(RootElement parent) {
820
        destroySections();
821

  
822
        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
823
        addPart(termVocabularyDetailSection);
824
    }
825

  
826
    private void createDefinedTermSection(RootElement parent) {
827
        destroySections();
828

  
829
        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
830
        addPart(definedTermDetailSection);
831
    }
832

  
833
	@Override
834
	public void update(CdmDataChangeMap arg0) {
835

  
836
	}
837

  
838
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)