Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / NomenclaturalPersonAuthorSelectionDialog.java
1 /**
2 * Copyright (C) 2016 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 org.eclipse.swt.widgets.Control;
12 import org.eclipse.swt.widgets.Shell;
13 import org.eclipse.swt.widgets.Text;
14
15 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 import eu.etaxonomy.cdm.api.service.IAgentService;
17 import eu.etaxonomy.cdm.model.agent.AgentBase;
18 import eu.etaxonomy.cdm.model.agent.Person;
19 import eu.etaxonomy.taxeditor.store.CdmStore;
20
21 /**
22 * @author k.luther
23 * @date 21.06.2016
24 *
25 */
26 public class NomenclaturalPersonAuthorSelectionDialog extends NomenclaturalAuthorSelectionDialog {
27
28 /**
29 * @param shell
30 * @param conversation
31 * @param title
32 * @param multi
33 * @param settings
34 * @param agent
35 */
36 protected NomenclaturalPersonAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
37 boolean multi, String settings, AgentBase agent, boolean teamMemberSelection) {
38 super(shell, conversation, title, multi, settings, agent, teamMemberSelection);
39 // TODO Auto-generated constructor stub
40 }
41
42
43 /**
44 * <p>select</p>
45 *
46 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
47 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
48 * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
49 * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
50 */
51 public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean teamMemberSelection) {
52 NomenclaturalPersonAuthorSelectionDialog dialog = new NomenclaturalPersonAuthorSelectionDialog(shell, conversation,
53 "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity,teamMemberSelection);
54 return getSelectionFromDialog(dialog);
55 }
56
57 @Override
58 protected void initModel() {
59 Control control = getPatternControl();
60 String pattern = null;
61 if (control != null){
62 pattern = ((Text)control).getText();
63 }
64
65 model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, Person.class);
66 }
67
68 }