X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/362c07aba5ebcac595e841de51a71d11623dc8e8..97e308a958cc205077d2f357a0d3531e845941c3:/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java index abec84df9..e919b5ea0 100755 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java @@ -6,9 +6,10 @@ * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ - package eu.etaxonomy.taxeditor.view.e4.details; +import java.util.Collection; +import java.util.EnumSet; import java.util.HashSet; import java.util.Set; @@ -21,28 +22,23 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.TreeNode; import org.eclipse.swt.SWT; +import org.springframework.security.core.GrantedAuthority; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; -import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; import eu.etaxonomy.cdm.model.agent.Person; import eu.etaxonomy.cdm.model.agent.Team; import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; -import eu.etaxonomy.cdm.model.common.DefinedTermBase; -import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.cdm.model.common.Marker; -import eu.etaxonomy.cdm.model.common.TermVocabulary; -import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.cdm.model.description.CategoricalData; import eu.etaxonomy.cdm.model.description.Character; import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; import eu.etaxonomy.cdm.model.description.Distribution; -import eu.etaxonomy.cdm.model.description.FeatureNode; -import eu.etaxonomy.cdm.model.description.FeatureTree; import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; import eu.etaxonomy.cdm.model.description.SpecimenDescription; +import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.cdm.model.molecular.DnaSample; import eu.etaxonomy.cdm.model.molecular.Sequence; @@ -52,11 +48,24 @@ import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; import eu.etaxonomy.cdm.model.occurrence.FieldUnit; import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; +import eu.etaxonomy.cdm.model.permission.CRUD; +import eu.etaxonomy.cdm.model.permission.Group; +import eu.etaxonomy.cdm.model.permission.User; import eu.etaxonomy.cdm.model.reference.Reference; +import eu.etaxonomy.cdm.model.taxon.Synonym; +import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonBase; +import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; +import eu.etaxonomy.cdm.model.term.DefinedTermBase; +import eu.etaxonomy.cdm.model.term.TermNode; +import eu.etaxonomy.cdm.model.term.TermTree; +import eu.etaxonomy.cdm.model.term.TermType; +import eu.etaxonomy.cdm.model.term.TermVocabulary; +import eu.etaxonomy.cdm.persistence.dto.TermNodeDto; +import eu.etaxonomy.cdm.persistence.dto.TermTreeDto; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; -import eu.etaxonomy.taxeditor.editor.IDistributionEditor; +import eu.etaxonomy.taxeditor.editor.IDistributionEditorPart; import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants; import eu.etaxonomy.taxeditor.l10n.Messages; import eu.etaxonomy.taxeditor.model.AbstractUtility; @@ -64,15 +73,20 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; -import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; +import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; +import eu.etaxonomy.taxeditor.store.CdmStore; +import eu.etaxonomy.taxeditor.store.StoreUtil; import eu.etaxonomy.taxeditor.store.UsageTermCollection; +import eu.etaxonomy.taxeditor.termtree.e4.ICharacterEditor; +import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.RootElement; import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection; import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection; import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection; import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection; +import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection; import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection; @@ -80,10 +94,14 @@ import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection; import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection; import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection; import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection; +import eu.etaxonomy.taxeditor.ui.section.description.detail.DistributionDetailElement; import eu.etaxonomy.taxeditor.ui.section.feature.CharacterDetailSection; +import eu.etaxonomy.taxeditor.ui.section.feature.CharacterNodeDetailSection; +import eu.etaxonomy.taxeditor.ui.section.feature.CharacterNodeDtoDetailSection; import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection; -import eu.etaxonomy.taxeditor.ui.section.feature.FeatureNodeDetailSection; -import eu.etaxonomy.taxeditor.ui.section.feature.FeatureTreeDetailSection; +import eu.etaxonomy.taxeditor.ui.section.feature.TermNodeDetailSection; +import eu.etaxonomy.taxeditor.ui.section.feature.TermTreeDetailSection; +import eu.etaxonomy.taxeditor.ui.section.feature.TermTreeDetailSectionForNode; import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection; import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection; import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection; @@ -92,7 +110,6 @@ import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection; import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection; import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection; -import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection; import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection; @@ -124,24 +141,25 @@ import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection; import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection; import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection; import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection; +import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermMediaSection; import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection; +import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart; import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4; /** - * * The DetailsViewer handles the content of the details view ( - * {@link DetailsViewerE4}).
+ * {@link DetailsPartE4}).
* Depending on the type of the selected element the section of the details view * are created. * * @author pplitzner * @date 18.07.2017 - * */ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { private ISelection selection; private boolean detailsEnabled = true; + private Object activePart; public boolean isDetailsEnabled() { return detailsEnabled; @@ -152,11 +170,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } public void setInput(Object input, Object activePart) { - if (activePart instanceof IDistributionEditor){ - detailsEnabled = false; - }else{ - detailsEnabled = true; - } + this.activePart = activePart; setInput(input); } @@ -174,17 +188,15 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { if(input instanceof GbifResponse){ input = ((GbifResponse) input).getDerivedUnitFacade(); } - if(input instanceof FeatureNode - && HibernateProxyHelper.isInstanceOf(((FeatureNode) input).getFeature(), Character.class)){ - input = HibernateProxyHelper.deproxy(((FeatureNode) input).getFeature(), Character.class); - } - if (input !=null && input.getClass().equals(DerivedUnit.class)) { + if (input instanceof MediaSpecimen && !(this.activePart.getClass().getSimpleName().equals("BulkEditorE4"))){ + //do nothing + }else if (input instanceof DerivedUnit) { DerivedUnit derivedUnit = (DerivedUnit)input; try { input = DerivedUnitFacade.NewInstance(derivedUnit, PreferencesUtil.getDerivedUnitConfigurator()); } catch (DerivedUnitFacadeNotSupportedException e) { - // 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 + 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 } } else if(input instanceof FieldUnit){ @@ -214,7 +226,6 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } } - /** {@inheritDoc} */ @Override protected void showParts() { // FIXME (CM) : Need to clean out this code. @@ -228,7 +239,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } destroySections(); if (input instanceof TaxonBase) { - if(((TaxonBase) input).getName()==null){ + if(((TaxonBase) input).getName()==null){ createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement); } else{ @@ -269,9 +280,11 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } else if (isUseDescription) { createUseDescriptionSection(rootElement); - } else { + } else if (input instanceof TaxonDescription){ createTaxonDescriptionSection(rootElement); + } else{ + createDescriptionSection(rootElement, false); } } } else if (input instanceof DescriptionElementBase){ @@ -290,16 +303,15 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { if (isUseDescription == true && input instanceof CategoricalData) { createUseRecordSection(rootElement); } else { - createDescriptionElementSection(rootElement); + createDescriptionElementSection(rootElement, activePart); } } else if (input instanceof Media) { createMediaElementSection(rootElement); - } //FIXME hack to show more informative message to the user when //DerivedUnit has more than one FieldUnit #4363 - else if (input.getClass().equals(DerivedUnit.class)) { + else if (input instanceof DerivedUnit && !(input instanceof MediaSpecimen)) { DerivedUnit derivedUnit = (DerivedUnit)input; try { input = DerivedUnitFacade.NewInstance(derivedUnit, @@ -309,28 +321,40 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } } else if (input instanceof DerivedUnitFacade) { - if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){ - if(((DerivedUnitFacade) input).innerFieldUnit()==null){ + DerivedUnitFacade facade = (DerivedUnitFacade) input; + if(facade.getType() == SpecimenOrObservationType.FieldUnit){ + if(facade.innerFieldUnit() == null){ MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$ } else{ createFieldUnitSection(rootElement); } } - else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){ - if(((DerivedUnitFacade) input).innerDerivedUnit()==null){ + else if(facade.getType() == SpecimenOrObservationType.PreservedSpecimen){ + if(facade.innerDerivedUnit() == null){ MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$ } else{ createDerivedUnitBaseElementSection(rootElement); } } - else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){ + else if(facade.getType() == SpecimenOrObservationType.TissueSample){ //TissueSample should only be created by using it's own class //in future using only one class with different SpecimenOrObservationTypes is desired createTissueSampleSection(rootElement); } - else{ + else if(facade.getType()==SpecimenOrObservationType.DnaSample){ + + if(facade.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType.TissueSample){ + //this case seems to be very unlikely as innerDerivedUnit has almost always the same type + createTissueSampleSection(rootElement); + } + else if(facade.innerDerivedUnit().getRecordBasis()==SpecimenOrObservationType.DnaSample){ + createDnaSampleSection(rootElement); + } + }else if (facade.innerDerivedUnit() instanceof MediaSpecimen){ + createEmptySection("Image specimen not supported by specimen list editor", rootElement); + }else{ createDerivedUnitBaseElementSection(rootElement); } } else if (input instanceof DnaSample){ @@ -353,12 +377,30 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { else if (input instanceof FeatureNodeContainer) { createFeatureDistributionSection(rootElement); - } else if (input instanceof FeatureNode) { - createFeatureNodeSection(rootElement); + } else if (input instanceof TermNode) { + TermType type= ((TermNode) input).getTermType(); + if(type.equals(TermType.Character) ){ + createCharacterNodeSection(rootElement); + } + else if(type.equals(TermType.Feature)){ + createFeatureNodeSection(rootElement); + } - } else if (input instanceof FeatureTree) { + } else if (input instanceof TermTree) { createFeatureTreeSection(rootElement); + } else if (input instanceof TermNodeDto) { + TermType type= ((TermNodeDto) input).getTerm().getTermType(); + if(type.equals(TermType.Character) && activePart instanceof ICharacterEditor){ + createCharacterNodeDtoSection(rootElement); + } + else if(type.equals(TermType.Feature) || type.equals(TermType.Character)){ + createFeatureNodeSection(rootElement); + } + + } else if (input instanceof TermTreeDto) { + createFeatureTreeSectionForDto(rootElement); + } else if (input instanceof Character) { createCharacterSection(rootElement); @@ -369,7 +411,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } else if (input instanceof Group) { createGroupSection(rootElement); } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null - && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedNameOrInvalidDesignation())){ + && (((TaxonRelationship)input).getType().isAnyMisappliedName() || ((TaxonRelationship)input).getType().isAnySynonym() || ((TaxonRelationship)input).getType().isMisappliedName())){ createMisappliedNameSection(rootElement); }else if (input instanceof TaxonRelationship ) { createTaxonRelationshipSection(rootElement); @@ -390,166 +432,215 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { createEmptySection(null, rootElement); } layout(); - } private void createGroupSection(RootElement parent) { - GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, getSectionStyle(GroupDetailSection.class)); - MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, getSectionStyle(MemberDetailSection.class)); - GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,getSectionStyle(GrantedAuthorityDetailSection.class)); + GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GroupDetailSection.class, getInput().getClass().getCanonicalName())); + MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(MemberDetailSection.class, getInput().getClass().getCanonicalName())); + GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,StoreUtil.getSectionStyle(GrantedAuthorityDetailSection.class, getInput().getClass().getCanonicalName())); addPart(groupDetailSection); addPart(memberDetailSection); addPart(grantedAuthorityDetailSection); } - /** {@inheritDoc} */ @Override public ISelection getSelection() { return selection; } - /** {@inheritDoc} */ @Override public void setSelection(ISelection selection, boolean reveal) { this.selection = selection; - if(this.selection!=null){ SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection); fireSelectionChanged(selectionChangedEvent); } - } private void createTaxonSections(RootElement parent) { + NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(); + EnumSet requiredCrud; + if(getInput() == null || StoreUtil.getCdmEntity(getInput()).getId() == 0) { + // new entity, not yet saved + requiredCrud = EnumSet.of(CRUD.CREATE); + } else { + requiredCrud = EnumSet.of(CRUD.UPDATE); + } + boolean hasPermission = CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getInput()), requiredCrud); + if (hasPermission){ + // check for subtree permissions as well. + TaxonBase taxonBase = (TaxonBase)getInput(); + Taxon acceptedTaxon = null; + if (taxonBase instanceof Taxon){ + acceptedTaxon = (Taxon)taxonBase; + }else{ + acceptedTaxon = ((Synonym)taxonBase).getAcceptedTaxon(); + } + if (acceptedTaxon != null){ //needs discussion if synonyms without accepted taxon should never be filtered by subtree permission(current implementation). See also #8849 + Set nodes = acceptedTaxon.getTaxonNodes(); + for (TaxonNode node: nodes){ + hasPermission &= CdmStore.currentAuthentiationHasPermission(node, requiredCrud); + if (!hasPermission){ + //check whether there are explicit TaxonNode rights + boolean taxonnodePermissionExists = false; + Collection authorities = CdmStore.getCurrentAuthentiation().getAuthorities(); + for (GrantedAuthority grantedAuthority: authorities){ + if (grantedAuthority.getAuthority().startsWith("TAXONNODE")){ + taxonnodePermissionExists = true; + } + } + if (!taxonnodePermissionExists){ + hasPermission = true; + } + } + } + } + } + detailsEnabled = hasPermission; ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, - getSectionStyle(ParsingMessagesSection.class, true)); - if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){ + StoreUtil.getSectionStyle(ParsingMessagesSection.class, getInput().getClass().getCanonicalName(), true)); + if (config == null){ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, - getSectionStyle(TaxonBaseDetailSection.class, true)); + StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); + // boolean hasPermission = CdmStore.currentAuthentiationHasPermission(getInput(), Operation.UPDATE); + taxonBaseDetailSection.setEnabled(detailsEnabled); addPart(taxonBaseDetailSection); }else{ - if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){ + if (config.isTaxonSectionActivated()){ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, - getSectionStyle(TaxonBaseDetailSection.class, true)); + StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true)); + taxonBaseDetailSection.setEnabled(detailsEnabled); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(taxonBaseDetailSection); } } NonViralNameDetailSection nonViralNameSection = formFactory .createNonViralNameDetailSection(getConversationHolder(), parent, this, true, - getSectionStyle(NonViralNameDetailSection.class, true)); + StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - 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))){ + nonViralNameSection.setEnabled(detailsEnabled); + if (config == null || config.isNomenclaturalReferenceSectionActivated()){ NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, - getSectionStyle(NomenclaturalReferenceDetailSection.class, true)); + StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true)); + referenceDetailSection.setEnabled(detailsEnabled); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(referenceDetailSection); } - 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))){ + if ( config == null || config.isNomenclaturalStatusSectionActivated()){ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, - getSectionStyle(NomenclaturalStatusSection.class, true)); + StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true)); + nomenclaturalStatusSection.setEnabled(detailsEnabled); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(nomenclaturalStatusSection); } - 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))){ - ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class)); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(protologSection); - } +// if ( config == null || config.isProtologueActivated()){ +// ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName())); +// protologSection.setEnabled(detailsEnabled); +// formFactory.createHorizontalSeparator(parent, SWT.BORDER); +// addPart(protologSection); +// } - 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))){ - TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class)); + if (config == null || config.isTypeDesignationSectionActivated()){ + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName())); + typeDesignationSection.setEnabled(detailsEnabled); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(typeDesignationSection); } - 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))){ - NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class)); + if (config == null || config.isNameRelationsSectionActivated()){ + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName())); + nameRelationshipSection.setEnabled(detailsEnabled); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(nameRelationshipSection); } - addPart(parsingMessagesSection); - addPart(nonViralNameSection); - } private void createNameSections(RootElement parent) { NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection( - getConversationHolder(), parent, this, false, getSectionStyle(NonViralNameDetailSection.class, true)); + getConversationHolder(), parent, this, false, StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, - getSectionStyle(NomenclaturalReferenceDetailSection.class, true)); + StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, - getSectionStyle(NomenclaturalStatusSection.class, true)); + StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(nonViralNameSection); addPart(nomenclaturalStatusSection); addPart(referenceDetailSection); - ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class)); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); +// ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName())); +// formFactory.createHorizontalSeparator(parent, SWT.BORDER); - TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class)); + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class)); + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(protologSection); +// addPart(protologSection); addPart(typeDesignationSection); addPart(nameRelationshipSection); - } private void createReferenceSections(RootElement parent) { ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, - getSectionStyle(ReferenceDetailSection.class, true)); + StoreUtil.getSectionStyle(ReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(referenceDetailSection); } private void createTeamOrPersonBaseDetailSection(RootElement parent) { - TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, getSectionStyle(TeamOrPersonBaseDetailSection.class, true)); + TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TeamOrPersonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(teamOrPersonBaseDetailSection); } private void createTeamDetailSection(RootElement parent) { - TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, getSectionStyle(TeamDetailSection.class, true)); + TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TeamDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(teamDetailSection); } private void createPersonDetailSection(RootElement parent) { - PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, getSectionStyle(PersonDetailSection.class, true)); + PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(PersonDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(personDetailSection); } private void createDescriptionElementSection(RootElement parent) { - DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionElementDetailSection.class, true)); + createDescriptionElementSection(parent, null); + } + + private void createDescriptionElementSection(RootElement parent, Object activePart) { + DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionElementDetailSection.class, getInput().getClass().getCanonicalName(), true)); descriptionElementDetailSection.setEnabled(this.detailsEnabled); - // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, getSectionStyle(.class)); + // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, getSectionStyle(.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); + DescriptionElementSourceSection descriptionElementSourceSection; + if (activePart != null && activePart instanceof IDistributionEditorPart){ + Reference defaultSource =((IDistributionEditorPart)activePart).getEditor().getDefaultSource(); + descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, defaultSource, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName())); - DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, getSectionStyle(DescriptionElementSourceSection.class)); + }else{ + descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) ); + } formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, getSectionStyle(DescriptionElementMediaSection.class)); + DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementMediaSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); @@ -559,25 +650,25 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) { - DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionDetailSection.class, true)); + DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(descriptionDetailSection); formFactory.createHorizontalSeparator(parent, SWT.BORDER); if(isTaxonDescription) { NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection( - getConversationHolder(), parent, this, getSectionStyle(NaturalLanguageSection.class, true)); + getConversationHolder(), parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(naturalLanguageSection); } DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection( - getConversationHolder(), parent, getSectionStyle(DescriptionSourceSection.class, true)); + getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true)); addPart(descriptionSourceSection); formFactory.createHorizontalSeparator(parent, SWT.BORDER); if(isTaxonDescription) { - ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, getSectionStyle(ScopeSection.class)); + ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName())); addPart(scopeSection); } } @@ -591,33 +682,32 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } private void createUseDescriptionSection(RootElement parent) { - DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionDetailSection.class)); + DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, getSectionStyle(DescriptionSourceSection.class)); + DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(descriptionDetailSection); addPart(descriptionSourceSection); - } private void createImageGallerySection(RootElement parent) { - DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, getSectionStyle(DescriptionDetailSection.class)); + DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName())); addPart(descriptionDetailSection); } private void createMediaElementSection(RootElement parent) { - MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, getSectionStyle(MediaDetailsSection.class)); + MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(MediaDetailsSection.class, getInput().getClass().getCanonicalName(), true)); addPart(mediaDetailSection); } private void createDerivedUnitBaseElementSection(RootElement parent) { - DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitGeneralDetailSection.class, true)); + DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539 if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){ derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true); @@ -626,107 +716,111 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitBaseDetailSection.class, true)); + DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitBaseDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(derivedUnitBaseDetailSection); //for editors working with facades if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){ formFactory.createHorizontalSeparator(parent, SWT.BORDER); - GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, getSectionStyle(GatheringEventDetailSection.class)); + GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName())); addPart(gatheringEventDetailSection); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitDetailSection.class)); + FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitDetailSection.class, getInput().getClass().getCanonicalName())); addPart(fieldUnitDetailSection); } else{ if(PreferencesUtil.isShowTaxonAssociations()){ formFactory.createHorizontalSeparator(parent, SWT.BORDER); - TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, getSectionStyle(TaxonAssociationDetailSection.class, true)); + TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonAssociationDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(taxonAssociationDetailSection); } formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, getSectionStyle(DerivedUnitFacadeIdentifierSection.class)); + DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DerivedUnitFacadeIdentifierSection.class, getInput().getClass().getCanonicalName())); addPart(identifierDetailSection); } if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){ formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, getSectionStyle(DeterminationDetailSection.class)); + DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName())); addPart(determinationDetailSection); } formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, getSectionStyle(DerivedUnitTypeDesignationSection.class)); + DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitTypeDesignationSection.class, getInput().getClass().getCanonicalName())); addPart(derivedUnitTypeDesignationSection); - } private void createFieldUnitSection(RootElement parent) { - FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitGeneralDetailSection.class, true)); + FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, getSectionStyle(GatheringEventDetailSection.class)); + GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, getSectionStyle(FieldUnitDetailSection.class)); + FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitDetailSection.class, getInput().getClass().getCanonicalName())); addPart(fielUnitGeneralDetailSection); addPart(gatheringEventDetailSection); addPart(fieldUnitDetailSection); - if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){ - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, getSectionStyle(DeterminationDetailSection.class)); - addPart(determinationDetailSection); - } + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName())); + addPart(determinationDetailSection); } private void createTissueSampleSection(RootElement parent) { - TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(TissueSampleGeneralDetailSection.class, true)); + TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TissueSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, getSectionStyle(SampleDesignationDetailSection.class, true)); + SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(section); addPart(sampleDesignationDetailSection); } private void createDnaSampleSection(RootElement parent) { - DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(DnaSampleGeneralDetailSection.class, true)); + DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, getSectionStyle(DnaSamplePreparationPreservationSection.class, true)); + DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaSamplePreparationPreservationSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, getSectionStyle(DnaQualityDetailSection.class, true)); + DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaQualityDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, getSectionStyle(SampleDesignationDetailSection.class, true)); + SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true)); + formFactory.createHorizontalSeparator(parent, SWT.BORDER); + DeterminationDetailSection determinationDetailSection = null; + if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){ + determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName())); + } addPart(section); addPart(preparationPreservationSection); addPart(qualitySection); addPart(sampleDesignationDetailSection); + if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){ + addPart(determinationDetailSection); + } } private void createSequenceSection(RootElement parent) { - SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(SequenceGeneralDetailSection.class, true)); + SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SequenceGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, getSectionStyle(SequenceReferenceCollectionDetailSection.class, true)); + SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceReferenceCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, getSectionStyle(SequenceContigFileCollectionDetailSection.class, true)); - + SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceContigFileCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(section); addPart(referenceSection); @@ -734,57 +828,68 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } private void createSingleReadSection(RootElement parent) { - SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(SingleReadGeneralDetailSection.class, true)); + SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SingleReadGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(section); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, getSectionStyle(SingleReadPherogramCollectionDetailSection.class, true)); + SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SingleReadPherogramCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(pherogramSection); - } private void createMediaSpecimenSection(RootElement parent) { - MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, getSectionStyle(MediaSpecimenGeneralDetailSection.class, true)); + MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(MediaSpecimenGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(generalSection); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, getSectionStyle(RightsSection.class)); + RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(RightsSection.class, getInput().getClass().getCanonicalName())); +// rightsSection.setEntity(generalSection.getEntity().innerDerivedUnit()); addPart(rightsSection); - } + private void createFeatureTreeSectionForDto(RootElement parent) { + TermTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true)); + + addPart(section); + } private void createFeatureTreeSection(RootElement parent) { - FeatureTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, getSectionStyle(FeatureTreeDetailSection.class, true)); + TermTreeDetailSectionForNode section = formFactory.createFeatureTreeDetailSectionForTree(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(section); } private void createFeatureNodeSection(RootElement parent) { - FeatureNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, getSectionStyle(FeatureNodeDetailSection.class, true)); - + TermNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermNodeDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(featureDistributionSection); } private void createFeatureDistributionSection(RootElement parent) { - FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, getSectionStyle(FeatureDistributionDetailSection.class, true)); + FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FeatureDistributionDetailSection.class, getInput().getClass().getCanonicalName(), true)); + addPart(featureDistributionSection); + } + private void createCharacterNodeSection(RootElement parent) { + CharacterNodeDetailSection featureDistributionSection = formFactory.createCharacterNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(featureDistributionSection); } - private void createCharacterSection(RootElement parent) { - CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, getSectionStyle(CharacterDetailSection.class, true)); + private void createCharacterNodeDtoSection(RootElement parent) { + CharacterNodeDtoDetailSection featureDistributionSection = formFactory.createCharacterNodeDtoDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true)); + addPart(featureDistributionSection); + } + private void createCharacterSection(RootElement parent) { + CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(featureDistributionSection); } private void createPolytomousKeyNodeSection(RootElement parent) { - PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, getSectionStyle(PolytomousKeyDetailSection.class)); + PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyDetailSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, getSectionStyle(PolytomousKeyNodeDetailSection.class, true)); + PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyNodeDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(polytomousKeyDetailSection); addPart(polytomousKeyNodeDetailSection); @@ -792,19 +897,15 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } private void createUseRecordSection(RootElement parent) { - UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,getSectionStyle(UseRecordDetailSection.class, true)); - + UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,StoreUtil.getSectionStyle(UseRecordDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(descriptionUseRecordSection); - - } private void createUserSection(RootElement parent) { - UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, getSectionStyle(UserDetailSection.class, true)); + UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(UserDetailSection.class, getInput().getClass().getCanonicalName(), true)); - GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, getSectionStyle(GroupsByUserDetailSection.class, true)); + GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(GroupsByUserDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(userDetailSection); addPart(groupByUserDetailSection); @@ -812,59 +913,58 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { private void createMisappliedNameSection(RootElement parent) { TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, - getSectionStyle(TaxonRelationshipDetailSection.class, true)); + StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(taxonRelationshipDetailSection); formFactory.createHorizontalSeparator(parent, SWT.BORDER); - NonViralNameDetailSection nonViralNameSection = formFactory .createNonViralNameDetailSection(getConversationHolder(), parent, this, true, - getSectionStyle(NonViralNameDetailSection.class, true)); + StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(nonViralNameSection); formFactory.createHorizontalSeparator(parent, SWT.BORDER); NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, - getSectionStyle(NomenclaturalReferenceDetailSection.class, true)); + StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(referenceDetailSection); - NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, - getSectionStyle(NomenclaturalStatusSection.class, true)); + StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true)); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(nomenclaturalStatusSection); - ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class)); - formFactory.createHorizontalSeparator(parent, SWT.BORDER); - addPart(protologSection); +// ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName())); +// formFactory.createHorizontalSeparator(parent, SWT.BORDER); +// addPart(protologSection); - TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class)); + TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(typeDesignationSection); - NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class)); + NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName())); formFactory.createHorizontalSeparator(parent, SWT.BORDER); addPart(nameRelationshipSection); - } private void createTaxonRelationshipSection(RootElement parent) { - TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, getSectionStyle(TaxonRelationshipDetailSection.class, true)); + TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true)); - ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, getSectionStyle(ReferencedEntityDetailSection.class, true)); + ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(ReferencedEntityDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(taxonRelationshipDetailSection); addPart(referencedEntityBaseDetailSection); } private void createTermVocabularySection(RootElement parent) { - TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, getSectionStyle(TermVocabularyDetailSection.class, true)); + TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermVocabularyDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(termVocabularyDetailSection); } private void createDefinedTermSection(RootElement parent) { - DefinedTermDetailSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, getSectionStyle(DefinedTermDetailSection.class, true)); + DefinedTermDetailSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true)); addPart(definedTermDetailSection); + TermMediaSection termMediaSection = formFactory.createTermMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true)); + addPart(termMediaSection); } @Override @@ -873,11 +973,27 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 { } @Inject @Optional - private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_TAXON_DETAILS)boolean refresh){ + private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS)boolean refresh){ if(refresh){ refresh(); + } + } -// setSelection(getSelection(), true); + @Inject + @Optional + private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS_DISTRIBUTION)String nameCache){ + if(nameCache != null && getInput() instanceof Distribution && this.activePart instanceof IDistributionEditorPart){ + if (part instanceof CdmSectionPart && ((CdmSectionPart)part).getSection() instanceof DescriptionElementDetailSection){ + for (ICdmFormElement element: ((DescriptionElementDetailSection)((CdmSectionPart)part).getSection()).getElements()){ + if (element instanceof DescriptionElementDetailElement){ + for(ICdmFormElement descriptionElement:((DescriptionElementDetailElement)element).getElements()){ + if (descriptionElement instanceof DistributionDetailElement){ + ((DistributionDetailElement) descriptionElement).setName(nameCache); + } + } + } + } + } } } -} +} \ No newline at end of file