institution selection can be filtered now, too
authorKatja Luther <k.luther@bgbm.org>
Mon, 27 Nov 2017 10:59:17 +0000 (11:59 +0100)
committerKatja Luther <k.luther@bgbm.org>
Mon, 27 Nov 2017 10:59:17 +0000 (11:59 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/InstitutionSelectionDialog.java

index 255b371646081bb24d25f143cc84c3c34fdb9f8d..3efc7bce10bb3af5b64f6fc2ae85b61fc12a419d 100644 (file)
@@ -11,7 +11,10 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
 import java.util.UUID;
 
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
 
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
@@ -68,7 +71,24 @@ public class InstitutionSelectionDialog extends
         */
        @Override
        protected void search() {
-               model = CdmStore.getService(IAgentService.class).getInstitutionUuidAndTitleCache();
+
+                Control control =getSearchField();
+               String pattern = null;
+               if (control != null){
+                   pattern = ((Text)control).getText();
+               }
+
+               if (pattern == null || pattern.equals("?")){
+                   model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Institution.class, null, null);
+               }else{
+                   model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Institution.class, limitOfInitialElements,pattern);
+               }
+               try {
+                   fillContentProvider(null);
+               } catch (CoreException e) {
+                   // TODO Auto-generated catch block
+                   e.printStackTrace();
+               }
        }
 
        /* (non-Javadoc)