2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
11 import java
.util
.UUID
;
13 import org
.eclipse
.swt
.widgets
.Shell
;
15 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
16 import eu
.etaxonomy
.cdm
.api
.service
.molecular
.IPrimerService
;
17 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
18 import eu
.etaxonomy
.cdm
.model
.molecular
.Primer
;
19 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
20 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
21 import eu
.etaxonomy
.taxeditor
.newWizard
.NewPrimerWizard
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class PrimerSelectionDialog
extends
30 AbstractFilteredCdmResourceSelectionDialog
<Primer
> {
32 public static Primer
select(Shell shell
, ConversationHolder conversation
, Primer primer
){
33 PrimerSelectionDialog dialog
= new PrimerSelectionDialog(shell
, conversation
,
34 "Choose Primer", false, PrimerSelectionDialog
.class.getCanonicalName(), primer
);
35 return getSelectionFromDialog(dialog
);
39 * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
41 protected PrimerSelectionDialog(Shell shell
, ConversationHolder conversation
, String title
,
42 boolean multi
, String settings
, Primer cdmObject
) {
43 super(shell
, conversation
, title
, multi
, settings
, cdmObject
);
48 protected Primer
getPersistentObject(UUID uuid
) {
49 Object object
= CdmStore
.getService(IPrimerService
.class).load(uuid
);
51 Primer primer
= (Primer
) HibernateProxyHelper
.deproxy(object
);
56 MessagingUtils
.error(this.getClass(), "Selected element is not a primer", null);
62 protected void initModel() {
63 model
= CdmStore
.getService(IPrimerService
.class).getPrimerUuidAndTitleCache();
67 * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getTitle(eu.etaxonomy.cdm.model.common.ICdmBase)
70 protected String
getTitle(Primer cdmObject
) {
72 return cdmObject
.getLabel();
74 return super.getTitle(cdmObject
);
79 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
80 return new NewPrimerWizard();
85 protected String
getNewWizardLinkText() {
86 return String
.format("Create a new <a>%1s</a>", "Primer ");