Merge branch 'release/5.10.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / AgentSelectionDialog.java
index 691e909f05d2d0346bfee77a36846c82813d7dba..a9cc19997624da805694ab79c77623f899d41130 100644 (file)
@@ -11,12 +11,9 @@ package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
 import java.util.UUID;
 
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.events.SelectionListener;
-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;
@@ -34,17 +31,17 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @created Sep 10, 2009
  * @version 1.0
  */
-public class AgentSelectionDialog extends
-               AbstractFilteredCdmResourceSelectionDialog<AgentBase> {
+public class AgentSelectionDialog<T extends AgentBase> extends
+               AbstractFilteredCdmResourceSelectionDialog {
 
        /**
         *
         */
-       protected static final String PERSON = "new Person";
+       protected static final String PERSON = "New Person";
        /**
         *
         */
-       protected static final String TEAM = "new Team";
+       protected static final String TEAM = "New Team";
 
        protected static boolean selectTeamMember;
 
@@ -60,7 +57,7 @@ public class AgentSelectionDialog extends
                AgentBase entity, boolean selectTeamMember) {
                AgentSelectionDialog dialog = new AgentSelectionDialog(shell, //conversation,
                                "Choose Agent", false, AgentSelectionDialog.class.getCanonicalName(), entity, selectTeamMember);
-               return getSelectionFromDialog(dialog);
+               return (AgentBase) getSelectionFromDialog(dialog);
        }
 
        /**
@@ -92,7 +89,7 @@ public class AgentSelectionDialog extends
                 */
                @Override
         public String getText(Object element) {
-                       AgentBase agent = getCdmObjectByUuid(((UuidAndTitleCache<AgentBase>) element).getUuid());
+                   AgentBase agent = (AgentBase) getCdmObjectByUuid(((UuidAndTitleCache<AgentBase>) element).getUuid());
                        if (agent instanceof INomenclaturalAuthor) {
                                return "Nomenclatural title: '" + ((INomenclaturalAuthor) agent).getNomenclaturalTitle() + "'";
                        } else {
@@ -148,26 +145,24 @@ public class AgentSelectionDialog extends
                return super.getNewWizardButtonSelectionListener();
        }
 
-       /** {@inheritDoc} */
-       @Override
-       protected void search() {
-           Control control = getSearchField();
-        String pattern = null;
-        if (control != null){
-            pattern = ((Text)control).getText();
-        }
-        if (pattern == null || pattern.equals("?")){
-            model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(null, null);
-        }else{
-            model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
-        }
-        try {
-            fillContentProvider(null);
-        } catch (CoreException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-       }
+//     /** {@inheritDoc} */
+//     @Override
+//     protected void search() {
+//         Control control = getSearchField();
+//        String pattern = null;
+//        if (control != null){
+//            pattern = ((Text)control).getText();
+//        }
+//
+//     }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#callService(java.lang.String)
+     */
+    @Override
+    void callService(String pattern) {
+        model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
+    }
 
 
 }