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;
* @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;
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);
}
/**
*/
@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 {
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);
+ }
}