Merge branch 'hotfix/5.45.1'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / TeamSelectionDialog.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.taxeditor.ui.dialog.selection;
10
11 import java.util.UUID;
12
13 import org.eclipse.swt.widgets.Shell;
14
15 import eu.etaxonomy.cdm.api.service.IAgentService;
16 import eu.etaxonomy.cdm.model.agent.Team;
17 import eu.etaxonomy.cdm.model.common.CdmBase;
18 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
19 import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22 /**
23 * @author n.hoffmann
24 * @created Sep 24, 2009
25 */
26 public class TeamSelectionDialog extends
27 AbstractFilteredCdmResourceSelectionDialog<Team> {
28
29 public static Team select(Shell shell,
30 Team team){
31 TeamSelectionDialog dialog = new TeamSelectionDialog(shell,
32 "Choose Team", false, TeamSelectionDialog.class.getCanonicalName(), team);
33 return getSelectionFromDialog(dialog);
34 }
35
36 protected TeamSelectionDialog(Shell shell,
37 String title, boolean multi, String settings,
38 Team cdmObject) {
39 super(shell, title, multi, settings, cdmObject);
40 }
41
42 @Override
43 protected void callService(String pattern) {
44 model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
45
46 }
47
48 @Override
49 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
50 return new NewTeamWizard();
51 }
52
53 @Override
54 protected String[] getNewWizardText() {
55 return new String[]{"New Team"};
56 }
57
58 @Override
59 protected Team getPersistentObject(UUID uuid) {
60 return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class);
61 }
62 }