reintegrated redlist branch into trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / NonViralNameDetailElement.java
index d4e17a472caef42b9a0a579f8b68cf870202d2fc..d75b3698af4acd72f44598fd999bfee39b63471b 100644 (file)
@@ -16,6 +16,8 @@ import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.cdm.model.name.NonViralName;
+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.ICdmFormElement;
@@ -71,9 +73,15 @@ public class NonViralNameDetailElement extends
 
         toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
 
-        combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
-        combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
-
+               combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
+               combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
+               
+        //TODO RL
+               if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+               toggleable_cache.setVisible(false);
+               combo_nomenclaturalCode.setVisible(false);
+        }
+        
         section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
         section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
         addControl(section_name);
@@ -83,10 +91,13 @@ public class NonViralNameDetailElement extends
         addControl(section_author);
         addElement(section_author);
 
-        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
-        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-        addControl(section_hybrid);
-        addElement(section_hybrid);
+        //TODO RL
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+               section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
+               section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+               addControl(section_hybrid);
+               addElement(section_hybrid);
+        }       
     }
 
        /** {@inheritDoc} */
@@ -106,9 +117,9 @@ public class NonViralNameDetailElement extends
        @Override
        public void setEntity(NonViralName entity) {
                super.setEntity(entity);
-               section_name.setEntity(entity);
-               section_author.setEntity(entity);
-               section_hybrid.setEntity(entity);
+               if (section_name!=null) section_name.setEntity(entity);
+               if (section_author!=null) section_author.setEntity(entity);
+               if (section_hybrid!=null) section_hybrid.setEntity(entity);
        }
 
        /** {@inheritDoc} */