cleanup and remove generics from Identifier class
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / e4 / details / DetailsViewerE4.java
index 3b64d70fedccd9db14efa376dafd57a60ac01ff1..e919b5ea0d7e6be1e1830232c05643e1cdc5dbe5 100755 (executable)
@@ -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,29 +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.eclipse.ui.forms.widgets.ExpandableComposite;
+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;
@@ -53,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;
@@ -65,16 +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.ui.element.AbstractFormSection;
+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;
@@ -82,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;
@@ -94,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;
@@ -125,24 +140,26 @@ import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
 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}).<br>
+ * {@link DetailsPartE4}).<br>
  * 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;
@@ -153,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);
 
     }
@@ -175,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){
@@ -215,7 +226,6 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         }
     }
 
-    /** {@inheritDoc} */
     @Override
     protected void showParts() {
         // FIXME (CM) : Need to clean out this code.
@@ -224,10 +234,12 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         // of the corresponding detail viewer.
 
         Object input = getInput();
-
+        if (input == null){
+            return;
+        }
         destroySections();
         if (input instanceof TaxonBase) {
-            if(((TaxonBase) input).getName()==null){
+            if(((TaxonBase<?>) input).getName()==null){
                 createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
             }
             else{
@@ -268,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){
@@ -289,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,
@@ -308,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){
@@ -352,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);
 
@@ -368,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);
@@ -389,168 +432,215 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
             createEmptySection(null, rootElement);
         }
         layout();
-
     }
 
     private void createGroupSection(RootElement parent) {
-        GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
-        MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-        GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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<CRUD> 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<TaxonNode> 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<? extends GrantedAuthority> 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,
-                ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
-        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,
-                    ExpandableComposite.TWISTIE        | ExpandableComposite.EXPANDED);
+                    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,
-                        ExpandableComposite.TWISTIE    | ExpandableComposite.EXPANDED);
+                        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,
-                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                        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,
-                    ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                    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,
-                    ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                    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, ExpandableComposite.TWISTIE);
-            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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE
-                | ExpandableComposite.EXPANDED);
+                getConversationHolder(), parent, this, false, StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
-                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
-                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                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, ExpandableComposite.TWISTIE);
-        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, ExpandableComposite.TWISTIE);
+        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        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,
-                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                StoreUtil.getSectionStyle(ReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
         addPart(referenceDetailSection);
     }
 
     private void createTeamOrPersonBaseDetailSection(RootElement parent) {
-        TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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,  ExpandableComposite.TWISTIE);
+        //  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, ExpandableComposite.TWISTIE);
+        }else{
+            descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) );
+        }
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementMediaSection.class, getInput().getClass().getCanonicalName()));
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
@@ -560,25 +650,25 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     }
 
     private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) {
-        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                    getConversationHolder(), parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(naturalLanguageSection);
         }
         DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
-                getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                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, ExpandableComposite.TWISTIE);
+            ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
             addPart(scopeSection);
         }
     }
@@ -592,33 +682,32 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     }
 
     private void createUseDescriptionSection(RootElement parent) {
-        DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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);
@@ -627,107 +716,111 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE);
+            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, ExpandableComposite.TWISTIE);
+            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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                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, ExpandableComposite.TWISTIE);
+            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, ExpandableComposite.TWISTIE);
+            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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE);
-            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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
+        SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceContigFileCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
         addPart(section);
         addPart(referenceSection);
@@ -735,57 +828,68 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     }
 
     private void createSingleReadSection(RootElement parent) {
-        SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+    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, ExpandableComposite.TWISTIE);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
         addPart(polytomousKeyDetailSection);
         addPart(polytomousKeyNodeDetailSection);
@@ -793,19 +897,15 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     }
 
     private void createUseRecordSection(RootElement parent) {
-        UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(UserDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
-        GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(GroupsByUserDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
         addPart(userDetailSection);
         addPart(groupByUserDetailSection);
@@ -813,59 +913,58 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
     private void createMisappliedNameSection(RootElement parent) {
         TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
-                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
         addPart(taxonRelationshipDetailSection);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-
         NonViralNameDetailSection nonViralNameSection = formFactory
                 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
-                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                        StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
         addPart(nonViralNameSection);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
-                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
         addPart(referenceDetailSection);
 
-
         NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
-                       ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                       StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
         addPart(nomenclaturalStatusSection);
 
-               ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-               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, ExpandableComposite.TWISTIE);
+               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, ExpandableComposite.TWISTIE);
+               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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
 
-        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermVocabularyDetailSection.class, getInput().getClass().getCanonicalName(), true));
         addPart(termVocabularyDetailSection);
     }
 
     private void createDefinedTermSection(RootElement parent) {
-        AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        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
@@ -874,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