ref #7998 Add termType to vocabulary selection dialog
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 11 Feb 2019 10:34:47 +0000 (11:34 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 11 Feb 2019 10:34:47 +0000 (11:34 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TermVocabularySelectionDialog.java

index 840497b09c146adab8c5c584a20912a2e5c1a56a..57fa646ff0bbc517d5bddf64f3f2fe906bc2dae6 100644 (file)
@@ -58,6 +58,7 @@ import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.model.common.Representation;
+import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.cdm.model.description.Character;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
@@ -147,7 +148,7 @@ public class CharacterEditor implements IFeatureTreeEditor,IConversationEnabled,
 
             @Override
             public void widgetSelected(SelectionEvent e) {
-                vocabulary = TermVocabularySelectionDialog.select("Select vocabulary for characters", btnChooseVoc.getShell(), null);
+                vocabulary = TermVocabularySelectionDialog.select("Select vocabulary for characters", btnChooseVoc.getShell(), vocabulary, TermType.Feature);
                 if(vocabulary!=null){
                     txtVocabulary.setText(vocabulary.getLabel());
                 }
index 449a41d4d87310f864d68711f42621c8a555a41a..f0b4183784ab0193ca728e42899b3c79d73ab3a6 100644 (file)
@@ -14,6 +14,7 @@ import java.util.UUID;
 import org.eclipse.swt.widgets.Shell;
 
 import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
 import eu.etaxonomy.taxeditor.newWizard.NewFeatureVocabularyWizard;
@@ -28,27 +29,35 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class TermVocabularySelectionDialog extends
                AbstractFilteredCdmResourceSelectionDialog<TermVocabulary> {
 
+    private TermType termType;
+
+    public static TermVocabulary select(String dialogTitle, Shell shell, TermVocabulary voc, TermType termType){
+        return select_internal(dialogTitle, shell, voc, termType);
+    }
+
     public static TermVocabulary select(String dialogTitle, Shell shell, TermVocabulary voc){
-        return select_internal(dialogTitle, shell, voc);
+        return select_internal(dialogTitle, shell, voc, null);
     }
 
     public static TermVocabulary select(Shell shell, TermVocabulary voc){
-        return select_internal("Choose Vocabulary", shell, voc);
+        return select_internal("Choose Vocabulary", shell, voc, null);
     }
 
-       private static TermVocabulary select_internal(String dialogTitle, Shell shell, TermVocabulary voc){
+    private static TermVocabulary select_internal(String dialogTitle, Shell shell, TermVocabulary voc,
+            TermType termType){
                TermVocabularySelectionDialog dialog = new TermVocabularySelectionDialog(shell,
                                dialogTitle!=null?dialogTitle:"Choose Vocabulary",
                                false,
                                TermVocabularySelectionDialog.class.getCanonicalName(),
-                               voc);
+                               voc, termType);
                return getSelectionFromDialog(dialog);
        }
 
        protected TermVocabularySelectionDialog(Shell shell,
                         String title, boolean multi,
-                       String settings, TermVocabulary cdmObject) {
+                       String settings, TermVocabulary cdmObject, TermType termType) {
                super(shell, title, multi, settings, cdmObject);
+               this.termType = termType;
        }
 
        @Override
@@ -58,7 +67,7 @@ public class TermVocabularySelectionDialog extends
 
        @Override
        protected void callService(String pattern) {
-        model = CdmStore.getService(IVocabularyService.class).getUuidAndTitleCache(TermVocabulary.class, limitOfInitialElements, pattern);
+        model = CdmStore.getService(IVocabularyService.class).getUuidAndTitleCache(TermVocabulary.class, termType, limitOfInitialElements, pattern);
        }
 
        @Override