fix #5977: create a new teammember should allow only persons
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / NomenclaturalPersonAuthorSelectionDialog.java
1 // $Id$
2 /**
3 * Copyright (C) 2016 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.ui.dialog.selection;
11
12 import org.eclipse.swt.widgets.Control;
13 import org.eclipse.swt.widgets.Shell;
14 import org.eclipse.swt.widgets.Text;
15
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.Person;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22 /**
23 * @author k.luther
24 * @date 21.06.2016
25 *
26 */
27 public class NomenclaturalPersonAuthorSelectionDialog extends NomenclaturalAuthorSelectionDialog {
28
29 /**
30 * @param shell
31 * @param conversation
32 * @param title
33 * @param multi
34 * @param settings
35 * @param agent
36 */
37 protected NomenclaturalPersonAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
38 boolean multi, String settings, AgentBase agent, boolean teamMemberSelection) {
39 super(shell, conversation, title, multi, settings, agent, teamMemberSelection);
40 // TODO Auto-generated constructor stub
41 }
42
43
44 /**
45 * <p>select</p>
46 *
47 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
48 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
49 * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
50 * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
51 */
52 public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean teamMemberSelection) {
53 NomenclaturalPersonAuthorSelectionDialog dialog = new NomenclaturalPersonAuthorSelectionDialog(shell, conversation,
54 "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity,teamMemberSelection);
55 return getSelectionFromDialog(dialog);
56 }
57
58 @Override
59 protected void initModel() {
60 Control control = getPatternControl();
61 String pattern = null;
62 if (control != null){
63 pattern = ((Text)control).getText();
64 }
65
66 model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, Person.class);
67 }
68
69 }