- added preference for showing Collecting Areas below Country in DetailsView (#4473)
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / FieldUnitGeneralDetailElement.java
index 840d84a0862957fa54fdba6a74cca6940d7aa44a..e127f9dd8b9aad7111a113a9a9627383ad8bf05f 100644 (file)
@@ -16,6 +16,8 @@ import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
@@ -74,10 +76,11 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
         combo_specorobstype.setSelection(entity.getType());
         selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
                 "Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
-
-        section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
-        section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-        section_collectingAreas.setEntity(entity);
+        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            section_collectingAreas.setEntity(entity);
+        }
 
         languageText_locality = formFactory.createLanguageStringWithLabelElement(formElement, "Locality",
                 entity.getLocality(), style);