2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
12 import java
.util
.UUID
;
14 import org
.eclipse
.core
.runtime
.CoreException
;
15 import org
.eclipse
.swt
.widgets
.Control
;
16 import org
.eclipse
.swt
.widgets
.Shell
;
17 import org
.eclipse
.swt
.widgets
.Text
;
19 import eu
.etaxonomy
.cdm
.api
.service
.IAgentService
;
20 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
21 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
22 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
23 import eu
.etaxonomy
.taxeditor
.newWizard
.NewInstitutionWizard
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 * @created Dec 15, 2010
31 public class InstitutionSelectionDialog
extends
32 AbstractFilteredCdmResourceSelectionDialog
<Institution
> {
34 public static Institution
select(Shell shell
,// ConversationHolder conversation,
35 Institution institution
){
36 InstitutionSelectionDialog dialog
= new InstitutionSelectionDialog(shell
, //conversation,
37 "Choose Institution", false, TeamSelectionDialog
.class.getCanonicalName(), institution
);
38 return getSelectionFromDialog(dialog
);
49 protected InstitutionSelectionDialog(Shell shell
,//ConversationHolder conversation,
50 String title
, boolean multi
,
51 String settings
, Institution cdmObject
) {
52 super(shell
, //conversation,
53 title
, multi
, settings
, cdmObject
);
57 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
60 protected Institution
getPersistentObject(UUID uuid
) {
61 AgentBase agentBase
= CdmStore
.getService(IAgentService
.class).load(uuid
);
63 if(agentBase
instanceof Institution
){
64 return (Institution
) agentBase
;
70 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
73 protected void search() {
75 Control control
=getSearchField();
76 String pattern
= null;
78 pattern
= ((Text
)control
).getText();
81 if (pattern
== null || pattern
.equals("?")){
82 model
= CdmStore
.getService(IAgentService
.class).getUuidAndTitleCache(Institution
.class, null, null);
84 model
= CdmStore
.getService(IAgentService
.class).getUuidAndTitleCache(Institution
.class, limitOfInitialElements
,pattern
);
87 fillContentProvider(null);
88 } catch (CoreException e
) {
89 // TODO Auto-generated catch block
95 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
98 protected String
[] getNewWizardText() {
99 return new String
[]{"Institution "};
103 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
106 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
107 return new NewInstitutionWizard();