3 * Copyright (C) 2016 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
12 import org
.eclipse
.swt
.widgets
.Shell
;
14 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
15 import eu
.etaxonomy
.cdm
.api
.service
.IAgentService
;
16 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
17 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 public class NomenclaturalAuthorSelectionDialog
extends AgentSelectionDialog
{
36 protected NomenclaturalAuthorSelectionDialog(Shell shell
, ConversationHolder conversation
, String title
,
37 boolean multi
, String settings
, AgentBase agent
) {
38 super(shell
, conversation
, title
, multi
, settings
, agent
);
39 // TODO Auto-generated constructor stub
43 protected void initModel() {
44 model
= CdmStore
.getService(IAgentService
.class).getUuidAndAbbrevTitleCache(null, null);
50 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
51 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
52 * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
53 * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
55 public static AgentBase
select(Shell shell
, ConversationHolder conversation
, AgentBase entity
) {
56 NomenclaturalAuthorSelectionDialog dialog
= new NomenclaturalAuthorSelectionDialog(shell
, conversation
,
57 "Choose Agent", false, NomenclaturalAuthorSelectionDialog
.class.getCanonicalName(), entity
);
58 return getSelectionFromDialog(dialog
);
64 * @param cdmObject a T object.
65 * @return a {@link java.lang.String} object.
68 protected String
getTitle(AgentBase cdmObject
) {
69 if(cdmObject
== null){
73 if (cdmObject
instanceof TeamOrPersonBase
) {
74 return ((TeamOrPersonBase
) cdmObject
).getNomenclaturalTitle();
75 } else if (cdmObject
instanceof AgentBase
){
76 return ((TeamOrPersonBase
) cdmObject
).getTitleCache();
79 throw new IllegalArgumentException("Generic method only" +
80 " supports cdmObject of type IIdentifiableEntity." +
81 " Please implement specific method in subclass.");