ref #3836: add only recommended modifiers to modifier combo
authorKatja Luther <k.luther@bgbm.org>
Mon, 8 Apr 2019 13:18:24 +0000 (15:18 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 8 Apr 2019 13:18:24 +0000 (15:18 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierElement.java

index 3784997..ee3b106 100644 (file)
@@ -16,15 +16,12 @@ import java.util.Set;
 
 import org.eclipse.swt.events.SelectionListener;
 
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.StateData;
 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
 import eu.etaxonomy.cdm.model.term.DefinedTerm;
 import eu.etaxonomy.cdm.model.term.TermType;
 import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.model.term.VocabularyEnum;
-import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -68,14 +65,16 @@ public class ModifierElement extends AbstractEntityCollectionElement<DefinedTerm
                    if(parentSection.getEntity() instanceof StateData){
                        StateData stateData = (StateData) parentSection.getEntity();
                        recommendedModifierEnumeration = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
-                   }
-                   if(parentSection.getEntity() instanceof StatisticalMeasurementValue){
+                   }else if(parentSection.getEntity() instanceof StatisticalMeasurementValue){
                        StatisticalMeasurementValue statisticalMeasurementValue = (StatisticalMeasurementValue)parentSection.getEntity();
                        recommendedModifierEnumeration = statisticalMeasurementValue.getQuantitativeData().getFeature().getRecommendedModifierEnumeration();
                    }
-                   if (!(parentSection.getParentElement() instanceof StateDataElement || parentSection.getParentElement() instanceof StatisticalMeasurementValueElement)){
-                       recommendedModifierEnumeration.add(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.Modifier.getUuid()));
+                   if (!(parentSection.getParentElement() instanceof DescriptionElementBase)){
+                       DescriptionElementBase element = (DescriptionElementBase) parentSection.getEntity();
+                recommendedModifierEnumeration = element.getFeature().getRecommendedModifierEnumeration();
+                       //recommendedModifierEnumeration.add(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.Modifier.getUuid()));
                    }
+
                    for (TermVocabulary<DefinedTerm> termVocabulary : recommendedModifierEnumeration) {
                        modifierTerms.addAll(termVocabulary.getTerms());
                    }