3 * Copyright (C) 2014 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 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
.molecular
.IPrimerService
;
18 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
19 import eu
.etaxonomy
.cdm
.model
.molecular
.Primer
;
20 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
21 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
22 import eu
.etaxonomy
.taxeditor
.newWizard
.NewPrimerWizard
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 public class PrimerSelectionDialog
extends
31 AbstractFilteredCdmResourceSelectionDialog
<Primer
> {
33 public static Primer
select(Shell shell
, ConversationHolder conversation
, Primer primer
){
34 PrimerSelectionDialog dialog
= new PrimerSelectionDialog(shell
, conversation
,
35 "Choose Unit", false, PrimerSelectionDialog
.class.getCanonicalName(), primer
);
36 return getSelectionFromDialog(dialog
);
40 * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
42 protected PrimerSelectionDialog(Shell shell
, ConversationHolder conversation
, String title
,
43 boolean multi
, String settings
, Primer cdmObject
) {
44 super(shell
, conversation
, title
, multi
, settings
, cdmObject
);
49 protected Primer
getPersistentObject(UUID uuid
) {
50 Object object
= CdmStore
.getService(IPrimerService
.class).load(uuid
);
52 Primer primer
= (Primer
) HibernateProxyHelper
.deproxy(object
);
57 MessagingUtils
.error(this.getClass(), "Selected unit is not a primer", null);
63 protected void initModel() {
64 model
= CdmStore
.getService(IPrimerService
.class).getPrimerUuidAndTitleCache();
68 * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getTitle(eu.etaxonomy.cdm.model.common.ICdmBase)
71 protected String
getTitle(Primer cdmObject
) {
73 return cdmObject
.getLabel();
75 return super.getTitle(cdmObject
);
80 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
81 return new NewPrimerWizard();
86 protected String
getNewWizardLinkText() {
87 return String
.format("Create a new <a>%1s</a>", "Primer ");