fix #8162 adapt terms to new package structure in TaxEditor
[taxeditor.git] / 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.HashSet;
13 import java.util.Set;
14
15 import javax.inject.Inject;
16
17 import org.eclipse.e4.core.di.annotations.Optional;
18 import org.eclipse.e4.ui.di.UIEventTopic;
19 import org.eclipse.jface.viewers.ISelection;
20 import org.eclipse.jface.viewers.IStructuredSelection;
21 import org.eclipse.jface.viewers.SelectionChangedEvent;
22 import org.eclipse.jface.viewers.TreeNode;
23 import org.eclipse.swt.SWT;
24
25 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
26 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
27 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
28 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
29 import eu.etaxonomy.cdm.model.agent.Person;
30 import eu.etaxonomy.cdm.model.agent.Team;
31 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
32 import eu.etaxonomy.cdm.model.term.DefinedTermBase;
33 import eu.etaxonomy.cdm.model.common.Group;
34 import eu.etaxonomy.cdm.model.common.Marker;
35 import eu.etaxonomy.cdm.model.term.TermVocabulary;
36 import eu.etaxonomy.cdm.model.common.User;
37 import eu.etaxonomy.cdm.model.description.CategoricalData;
38 import eu.etaxonomy.cdm.model.description.Character;
39 import eu.etaxonomy.cdm.model.description.DescriptionBase;
40 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
41 import eu.etaxonomy.cdm.model.description.Distribution;
42 import eu.etaxonomy.cdm.model.description.FeatureNode;
43 import eu.etaxonomy.cdm.model.description.FeatureTree;
44 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
45 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
46 import eu.etaxonomy.cdm.model.description.TaxonDescription;
47 import eu.etaxonomy.cdm.model.media.Media;
48 import eu.etaxonomy.cdm.model.molecular.DnaSample;
49 import eu.etaxonomy.cdm.model.molecular.Sequence;
50 import eu.etaxonomy.cdm.model.molecular.SingleRead;
51 import eu.etaxonomy.cdm.model.name.TaxonName;
52 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
53 import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
54 import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
55 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
56 import eu.etaxonomy.cdm.model.reference.Reference;
57 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
58 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
59 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
60 import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
61 import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
62 import eu.etaxonomy.taxeditor.l10n.Messages;
63 import eu.etaxonomy.taxeditor.model.AbstractUtility;
64 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
65 import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
66 import eu.etaxonomy.taxeditor.model.MessagingUtils;
67 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
68 import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
69 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
70 import eu.etaxonomy.taxeditor.store.UsageTermCollection;
71 import eu.etaxonomy.taxeditor.ui.element.RootElement;
72 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
73 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
74 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
75 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
76 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
77 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
78 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
79 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
80 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
81 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
82 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
83 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
84 import eu.etaxonomy.taxeditor.ui.section.feature.CharacterDetailSection;
85 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
86 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureNodeDetailSection;
87 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureTreeDetailSection;
88 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
89 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
90 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
91 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
92 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
93 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
94 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
95 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
96 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
97 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
98 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
99 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
100 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
101 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
102 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
103 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
104 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
105 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
106 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
107 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
108 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
109 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
110 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
111 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
112 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
113 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
114 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
115 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
116 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
117 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
118 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
119 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
120 import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
121 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
122 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
123 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
124 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
125 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
126 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
127 import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
128 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
129 import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
130
131 /**
132 *
133 * The DetailsViewer handles the content of the details view (
134 * {@link DetailsPartE4}).<br>
135 * Depending on the type of the selected element the section of the details view
136 * are created.
137 *
138 * @author pplitzner
139 * @date 18.07.2017
140 *
141 */
142 public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
143
144 private ISelection selection;
145 private boolean detailsEnabled = true;
146
147 public boolean isDetailsEnabled() {
148 return detailsEnabled;
149 }
150
151 public void setDetailsEnabled(boolean detailsEnabled) {
152 this.detailsEnabled = detailsEnabled;
153 }
154
155 public void setInput(Object input, Object activePart) {
156 if (activePart instanceof IDistributionEditor){
157 detailsEnabled = false;
158 }else{
159 detailsEnabled = true;
160 }
161 setInput(input);
162
163 }
164 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
165 // since we are getting implementations of DerivedUnitBase from the bulk
166 // editor
167 // and not derived unit facade objects,
168
169 @Override
170 public void setInput(Object input) {
171
172 if(input instanceof TreeNode){
173 input = ((TreeNode) input).getValue();
174 }
175 if(input instanceof GbifResponse){
176 input = ((GbifResponse) input).getDerivedUnitFacade();
177 }
178 if(input instanceof FeatureNode
179 && HibernateProxyHelper.isInstanceOf(((FeatureNode) input).getTerm(), Character.class)){
180 input = HibernateProxyHelper.deproxy(((FeatureNode) input).getTerm(), Character.class);
181 }
182 if (input !=null && input.getClass().equals(DerivedUnit.class)) {
183 DerivedUnit derivedUnit = (DerivedUnit)input;
184 try {
185 input = DerivedUnitFacade.NewInstance(derivedUnit,
186 PreferencesUtil.getDerivedUnitConfigurator());
187 } catch (DerivedUnitFacadeNotSupportedException e) {
188 // MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
189 }
190 }
191 else if(input instanceof FieldUnit){
192 input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
193 }
194 super.setInput(input);
195 }
196
197 @Override
198 protected void markViewPartDirty() {
199 if (getInput() instanceof DerivedUnitFacade) {
200 if(part instanceof IDerivedUnitFacadePart){
201 part.changed(getInput());
202 }
203 else{
204 DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
205 if(facade.innerDerivedUnit()!=null){
206 part.changed(facade.innerDerivedUnit());
207 }
208 else if(facade.innerFieldUnit()!=null){
209 part.changed(facade.innerFieldUnit());
210 }
211 }
212 }
213 else{
214 super.markViewPartDirty();
215 }
216 }
217
218 /** {@inheritDoc} */
219 @Override
220 protected void showParts() {
221 // FIXME (CM) : Need to clean out this code.
222 // Too much type checking to decide which detail view to display.
223 // Need to build in a mechanism where navigators / editors are 'aware'
224 // of the corresponding detail viewer.
225
226 Object input = getInput();
227 if (input == null){
228 return;
229 }
230 destroySections();
231 if (input instanceof TaxonBase) {
232 if(((TaxonBase) input).getName()==null){
233 createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
234 }
235 else{
236 createTaxonSections(rootElement);
237 }
238
239 } else if (input instanceof TaxonName) {
240 createNameSections(rootElement);
241
242 } else if (input instanceof Reference) {
243 createReferenceSections(rootElement);
244
245 } else if (input instanceof Team) {
246 createTeamDetailSection(rootElement);
247
248 } else if (input instanceof Person) {
249 createPersonDetailSection(rootElement);
250
251 } else if (input instanceof TeamOrPersonBase) {
252 createTeamOrPersonBaseDetailSection(rootElement);
253
254 } else if (input instanceof DescriptionBase) {
255 if(input instanceof SpecimenDescription){
256 //TODO: add more sections to DetailsView for SpecimenDescription
257 createSpecimenDescriptionSection(rootElement);
258 }
259 else{
260 Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
261
262 Boolean isUseDescription = false;
263 for (Marker marker : descriptionMarkers) {
264 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
265 isUseDescription = true;
266 }
267 }
268 if (((DescriptionBase<?>) input).isImageGallery()) {
269 createImageGallerySection(rootElement);
270
271 } else if (isUseDescription) {
272 createUseDescriptionSection(rootElement);
273 } else if (input instanceof TaxonDescription){
274 createTaxonDescriptionSection(rootElement);
275
276 } else{
277 createDescriptionSection(rootElement, false);
278 }
279 }
280 } else if (input instanceof DescriptionElementBase){
281 Set<Marker> descriptionMarkers = new HashSet<>();
282 if(((DescriptionElementBase) input).getInDescription()!=null) {
283 descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
284 }
285
286 Boolean isUseDescription = false;
287 for (Marker marker : descriptionMarkers) {
288 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
289 isUseDescription = true;
290 }
291 }
292
293 if (isUseDescription == true && input instanceof CategoricalData) {
294 createUseRecordSection(rootElement);
295 } else {
296 createDescriptionElementSection(rootElement);
297 }
298
299 } else if (input instanceof Media) {
300 createMediaElementSection(rootElement);
301
302 }
303 //FIXME hack to show more informative message to the user when
304 //DerivedUnit has more than one FieldUnit #4363
305 else if (input.getClass().equals(DerivedUnit.class)) {
306 DerivedUnit derivedUnit = (DerivedUnit)input;
307 try {
308 input = DerivedUnitFacade.NewInstance(derivedUnit,
309 PreferencesUtil.getDerivedUnitConfigurator());
310 } catch (DerivedUnitFacadeNotSupportedException e) {
311 createEmptySection(e.getMessage(), rootElement);
312 }
313 }
314 else if (input instanceof DerivedUnitFacade) {
315 if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
316 if(((DerivedUnitFacade) input).innerFieldUnit()==null){
317 MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
318 }
319 else{
320 createFieldUnitSection(rootElement);
321 }
322 }
323 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
324 if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
325 MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
326 }
327 else{
328 createDerivedUnitBaseElementSection(rootElement);
329 }
330 }
331 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
332 //TissueSample should only be created by using it's own class
333 //in future using only one class with different SpecimenOrObservationTypes is desired
334 createTissueSampleSection(rootElement);
335 }
336 else{
337 createDerivedUnitBaseElementSection(rootElement);
338 }
339 } else if (input instanceof DnaSample){
340 DnaSample dnaSample = (DnaSample)input;
341 if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
342 createTissueSampleSection(rootElement);
343 }
344 else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
345 createDnaSampleSection(rootElement);
346 }
347 } else if (input instanceof MediaSpecimen){
348 createMediaSpecimenSection(rootElement);
349 }
350 else if(input instanceof Sequence){
351 createSequenceSection(rootElement);
352 }
353 else if(input instanceof SingleRead){
354 createSingleReadSection(rootElement);
355 }
356 else if (input instanceof FeatureNodeContainer) {
357 createFeatureDistributionSection(rootElement);
358
359 } else if (input instanceof FeatureNode) {
360 createFeatureNodeSection(rootElement);
361
362 } else if (input instanceof FeatureTree) {
363 createFeatureTreeSection(rootElement);
364
365 } else if (input instanceof Character) {
366 createCharacterSection(rootElement);
367
368 }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
369 createPolytomousKeyNodeSection(rootElement);
370 } else if (input instanceof User) {
371 createUserSection(rootElement);
372 } else if (input instanceof Group) {
373 createGroupSection(rootElement);
374 } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
375 && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedNameOrInvalidDesignation())){
376 createMisappliedNameSection(rootElement);
377 }else if (input instanceof TaxonRelationship ) {
378 createTaxonRelationshipSection(rootElement);
379 } else if (input instanceof TermVocabulary) {
380 createTermVocabularySection(rootElement);
381 } else if (input instanceof DefinedTermBase) {
382 createDefinedTermSection(rootElement);
383
384 } else if (input instanceof SelectionChangedEvent ) {
385 IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
386 if (sel.getFirstElement()instanceof Distribution){
387 createDescriptionElementSection(rootElement);
388 }
389
390 // createDescriptionElementSection(rootElement);
391
392 }else {
393 createEmptySection(null, rootElement);
394 }
395 layout();
396
397 }
398
399 private void createGroupSection(RootElement parent) {
400 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, getSectionStyle(GroupDetailSection.class));
401 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, getSectionStyle(MemberDetailSection.class));
402 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,getSectionStyle(GrantedAuthorityDetailSection.class));
403
404 addPart(groupDetailSection);
405 addPart(memberDetailSection);
406 addPart(grantedAuthorityDetailSection);
407 }
408
409 /** {@inheritDoc} */
410 @Override
411 public ISelection getSelection() {
412 return selection;
413 }
414
415 /** {@inheritDoc} */
416 @Override
417 public void setSelection(ISelection selection, boolean reveal) {
418
419 this.selection = selection;
420
421 if(this.selection!=null){
422 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
423 fireSelectionChanged(selectionChangedEvent);
424 }
425
426 }
427
428 private void createTaxonSections(RootElement parent) {
429 NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration();
430 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
431 getSectionStyle(ParsingMessagesSection.class, true));
432 if (!config.isSimpleDetailsViewActivated()){
433 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
434 getSectionStyle(TaxonBaseDetailSection.class, true));
435 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
436 addPart(taxonBaseDetailSection);
437 }else{
438 if (config.isTaxonSectionActivated()){
439 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
440 getSectionStyle(TaxonBaseDetailSection.class, true));
441 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
442 addPart(taxonBaseDetailSection);
443 }
444 }
445 NonViralNameDetailSection nonViralNameSection = formFactory
446 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
447 getSectionStyle(NonViralNameDetailSection.class, true));
448 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
449 if (!config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isNomenclaturalReferenceSectionActivated())){
450 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
451 getSectionStyle(NomenclaturalReferenceDetailSection.class, true));
452 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
453 addPart(referenceDetailSection);
454
455 }
456 if ( !config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isNomenclaturalStatusSectionActivated())){
457 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
458 getSectionStyle(NomenclaturalStatusSection.class, true));
459 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
460 addPart(nomenclaturalStatusSection);
461 }
462
463 if ( !config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isProtologueActivated())){
464 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class));
465 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
466 addPart(protologSection);
467 }
468
469 if (!config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isTypeDesignationSectionActivated())){
470 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class));
471 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
472 addPart(typeDesignationSection);
473 }
474
475 if (!config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() &&config.isNameRelationsSectionActivated())){
476 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class));
477 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
478 addPart(nameRelationshipSection);
479 }
480
481
482 addPart(parsingMessagesSection);
483
484 addPart(nonViralNameSection);
485
486 }
487
488 private void createNameSections(RootElement parent) {
489 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
490 getConversationHolder(), parent, this, false, getSectionStyle(NonViralNameDetailSection.class, true));
491
492 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
493
494 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
495 getSectionStyle(NomenclaturalReferenceDetailSection.class, true));
496 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
497
498 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
499 getSectionStyle(NomenclaturalStatusSection.class, true));
500 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
501
502 addPart(nonViralNameSection);
503 addPart(nomenclaturalStatusSection);
504 addPart(referenceDetailSection);
505
506 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class));
507 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
508
509 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class));
510 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
511
512 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class));
513 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
514 addPart(protologSection);
515 addPart(typeDesignationSection);
516 addPart(nameRelationshipSection);
517
518 }
519
520 private void createReferenceSections(RootElement parent) {
521 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
522 getSectionStyle(ReferenceDetailSection.class, true));
523
524 addPart(referenceDetailSection);
525 }
526
527 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
528 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, getSectionStyle(TeamOrPersonBaseDetailSection.class, true));
529
530 addPart(teamOrPersonBaseDetailSection);
531 }
532
533 private void createTeamDetailSection(RootElement parent) {
534 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, getSectionStyle(TeamDetailSection.class, true));
535
536 addPart(teamDetailSection);
537 }
538
539 private void createPersonDetailSection(RootElement parent) {
540 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, getSectionStyle(PersonDetailSection.class, true));
541 addPart(personDetailSection);
542 }
543
544 private void createDescriptionElementSection(RootElement parent) {
545 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionElementDetailSection.class, true));
546 descriptionElementDetailSection.setEnabled(this.detailsEnabled);
547
548 // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, getSectionStyle(.class));
549
550 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
551
552 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, getSectionStyle(DescriptionElementSourceSection.class));
553
554 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
555
556 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, getSectionStyle(DescriptionElementMediaSection.class));
557
558 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
559
560 addPart(descriptionElementDetailSection);
561 addPart(descriptionElementSourceSection);
562 addPart(descriptionElementMediaSection);
563 }
564
565 private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) {
566 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionDetailSection.class, true));
567 addPart(descriptionDetailSection);
568
569 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
570
571 if(isTaxonDescription) {
572 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
573 getConversationHolder(), parent, this, getSectionStyle(NaturalLanguageSection.class, true));
574 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
575 addPart(naturalLanguageSection);
576 }
577 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
578 getConversationHolder(), parent, getSectionStyle(DescriptionSourceSection.class, true));
579 addPart(descriptionSourceSection);
580
581 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
582
583 if(isTaxonDescription) {
584 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, getSectionStyle(ScopeSection.class));
585 addPart(scopeSection);
586 }
587 }
588
589 private void createTaxonDescriptionSection(RootElement parent) {
590 createDescriptionSection(parent, true);
591 }
592
593 private void createSpecimenDescriptionSection(RootElement parent) {
594 createDescriptionSection(parent, false);
595 }
596
597 private void createUseDescriptionSection(RootElement parent) {
598 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionDetailSection.class));
599
600 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
601
602 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, getSectionStyle(DescriptionSourceSection.class));
603
604 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
605
606 addPart(descriptionDetailSection);
607 addPart(descriptionSourceSection);
608
609 }
610
611 private void createImageGallerySection(RootElement parent) {
612 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionDetailSection.class));
613
614 addPart(descriptionDetailSection);
615 }
616
617 private void createMediaElementSection(RootElement parent) {
618 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, getSectionStyle(MediaDetailsSection.class));
619
620 addPart(mediaDetailSection);
621 }
622
623 private void createDerivedUnitBaseElementSection(RootElement parent) {
624 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitGeneralDetailSection.class, true));
625 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
626 if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
627 derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
628 }
629 addPart(derivedUnitGeneralDetailSection);
630
631 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
632
633 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitBaseDetailSection.class, true));
634 addPart(derivedUnitBaseDetailSection);
635
636 //for editors working with facades
637 if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
638 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
639 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, getSectionStyle(GatheringEventDetailSection.class));
640 addPart(gatheringEventDetailSection);
641
642 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
643 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitDetailSection.class));
644 addPart(fieldUnitDetailSection);
645 }
646 else{
647
648 if(PreferencesUtil.isShowTaxonAssociations()){
649 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
650 TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, getSectionStyle(TaxonAssociationDetailSection.class, true));
651 addPart(taxonAssociationDetailSection);
652 }
653 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
654 DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, getSectionStyle(DerivedUnitFacadeIdentifierSection.class));
655 addPart(identifierDetailSection);
656 }
657 if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
658 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
659 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, getSectionStyle(DeterminationDetailSection.class));
660 addPart(determinationDetailSection);
661 }
662
663 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
664 DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitTypeDesignationSection.class));
665 addPart(derivedUnitTypeDesignationSection);
666
667 }
668
669 private void createFieldUnitSection(RootElement parent) {
670 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitGeneralDetailSection.class, true));
671
672 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
673
674 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, getSectionStyle(GatheringEventDetailSection.class));
675
676 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
677
678 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitDetailSection.class));
679
680 addPart(fielUnitGeneralDetailSection);
681 addPart(gatheringEventDetailSection);
682 addPart(fieldUnitDetailSection);
683
684 if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
685 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
686 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, getSectionStyle(DeterminationDetailSection.class));
687 addPart(determinationDetailSection);
688 }
689 }
690
691 private void createTissueSampleSection(RootElement parent) {
692 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(TissueSampleGeneralDetailSection.class, true));
693
694 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
695
696 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, getSectionStyle(SampleDesignationDetailSection.class, true));
697
698 addPart(section);
699 addPart(sampleDesignationDetailSection);
700 }
701
702 private void createDnaSampleSection(RootElement parent) {
703 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(DnaSampleGeneralDetailSection.class, true));
704
705 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
706
707 DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, getSectionStyle(DnaSamplePreparationPreservationSection.class, true));
708
709 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
710
711 DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, getSectionStyle(DnaQualityDetailSection.class, true));
712
713 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
714
715 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, getSectionStyle(SampleDesignationDetailSection.class, true));
716
717 addPart(section);
718 addPart(preparationPreservationSection);
719 addPart(qualitySection);
720 addPart(sampleDesignationDetailSection);
721 }
722
723 private void createSequenceSection(RootElement parent) {
724 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(SequenceGeneralDetailSection.class, true));
725
726 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
727
728 SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, getSectionStyle(SequenceReferenceCollectionDetailSection.class, true));
729
730 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
731
732 SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, getSectionStyle(SequenceContigFileCollectionDetailSection.class, true));
733
734
735 addPart(section);
736 addPart(referenceSection);
737 addPart(contigFileSection);
738 }
739
740 private void createSingleReadSection(RootElement parent) {
741 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(SingleReadGeneralDetailSection.class, true));
742 addPart(section);
743
744 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
745
746 SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, getSectionStyle(SingleReadPherogramCollectionDetailSection.class, true));
747 addPart(pherogramSection);
748
749 }
750
751 private void createMediaSpecimenSection(RootElement parent) {
752 MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(MediaSpecimenGeneralDetailSection.class, true));
753 addPart(generalSection);
754
755 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
756
757 RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, getSectionStyle(RightsSection.class));
758 addPart(rightsSection);
759
760 }
761
762 private void createFeatureTreeSection(RootElement parent) {
763 FeatureTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, getSectionStyle(FeatureTreeDetailSection.class, true));
764
765 addPart(section);
766 }
767
768 private void createFeatureNodeSection(RootElement parent) {
769 FeatureNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, getSectionStyle(FeatureNodeDetailSection.class, true));
770
771 addPart(featureDistributionSection);
772 }
773
774 private void createFeatureDistributionSection(RootElement parent) {
775 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, getSectionStyle(FeatureDistributionDetailSection.class, true));
776
777 addPart(featureDistributionSection);
778 }
779
780 private void createCharacterSection(RootElement parent) {
781 CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, getSectionStyle(CharacterDetailSection.class, true));
782
783 addPart(featureDistributionSection);
784 }
785
786 private void createPolytomousKeyNodeSection(RootElement parent) {
787 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, getSectionStyle(PolytomousKeyDetailSection.class));
788
789 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
790
791 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, getSectionStyle(PolytomousKeyNodeDetailSection.class, true));
792
793 addPart(polytomousKeyDetailSection);
794 addPart(polytomousKeyNodeDetailSection);
795
796 }
797
798 private void createUseRecordSection(RootElement parent) {
799 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,getSectionStyle(UseRecordDetailSection.class, true));
800
801 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
802
803 addPart(descriptionUseRecordSection);
804
805
806 }
807
808 private void createUserSection(RootElement parent) {
809 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, getSectionStyle(UserDetailSection.class, true));
810
811 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, getSectionStyle(GroupsByUserDetailSection.class, true));
812
813 addPart(userDetailSection);
814 addPart(groupByUserDetailSection);
815 }
816
817 private void createMisappliedNameSection(RootElement parent) {
818 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
819 getSectionStyle(TaxonRelationshipDetailSection.class, true));
820 addPart(taxonRelationshipDetailSection);
821
822 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
823
824
825 NonViralNameDetailSection nonViralNameSection = formFactory
826 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
827 getSectionStyle(NonViralNameDetailSection.class, true));
828 addPart(nonViralNameSection);
829
830 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
831
832 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
833 getSectionStyle(NomenclaturalReferenceDetailSection.class, true));
834 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
835 addPart(referenceDetailSection);
836
837
838 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
839 getSectionStyle(NomenclaturalStatusSection.class, true));
840 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
841 addPart(nomenclaturalStatusSection);
842
843 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class));
844 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
845 addPart(protologSection);
846
847 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class));
848 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
849 addPart(typeDesignationSection);
850
851 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class));
852 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
853 addPart(nameRelationshipSection);
854
855 }
856
857 private void createTaxonRelationshipSection(RootElement parent) {
858 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, getSectionStyle(TaxonRelationshipDetailSection.class, true));
859
860 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, getSectionStyle(ReferencedEntityDetailSection.class, true));
861 addPart(taxonRelationshipDetailSection);
862 addPart(referencedEntityBaseDetailSection);
863 }
864 private void createTermVocabularySection(RootElement parent) {
865 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, getSectionStyle(TermVocabularyDetailSection.class, true));
866 addPart(termVocabularyDetailSection);
867 }
868
869 private void createDefinedTermSection(RootElement parent) {
870 DefinedTermDetailSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, getSectionStyle(DefinedTermDetailSection.class, true));
871 addPart(definedTermDetailSection);
872 }
873
874 @Override
875 public void update(CdmDataChangeMap arg0) {
876
877 }
878 @Inject
879 @Optional
880 private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS)boolean refresh){
881 if(refresh){
882 refresh();
883
884 }
885 }
886
887 }