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
.swt
.widgets
.Shell
;
16 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
17 import eu
.etaxonomy
.cdm
.api
.service
.IAgentService
;
18 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
19 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
20 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
21 import eu
.etaxonomy
.taxeditor
.newWizard
.NewInstitutionWizard
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * @created Dec 15, 2010
29 public class InstitutionSelectionDialog
extends
30 AbstractFilteredCdmResourceSelectionDialog
<Institution
> {
32 public static Institution
select(Shell shell
, ConversationHolder conversation
, Institution institution
){
33 InstitutionSelectionDialog dialog
= new InstitutionSelectionDialog(shell
, conversation
,
34 "Choose Institution", false, TeamSelectionDialog
.class.getCanonicalName(), institution
);
35 return getSelectionFromDialog(dialog
);
46 protected InstitutionSelectionDialog(Shell shell
,
47 ConversationHolder conversation
, String title
, boolean multi
,
48 String settings
, Institution cdmObject
) {
49 super(shell
, conversation
, title
, multi
, settings
, cdmObject
);
53 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
56 protected Institution
getPersistentObject(UUID uuid
) {
57 AgentBase agentBase
= CdmStore
.getService(IAgentService
.class).load(uuid
);
59 if(agentBase
instanceof Institution
){
60 return (Institution
) agentBase
;
66 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
69 protected void initModel() {
70 model
= CdmStore
.getService(IAgentService
.class).getInstitutionUuidAndTitleCache();
74 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
77 protected String
getNewWizardLinkText() {
78 return String
.format("Create a new <a>%1s</a>", "Institution ");
82 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
85 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
86 return new NewInstitutionWizard();