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
.service
.molecular
.IPrimerService
;
16 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
17 import eu
.etaxonomy
.cdm
.model
.molecular
.Primer
;
18 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
19 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
20 import eu
.etaxonomy
.taxeditor
.newWizard
.NewPrimerWizard
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
28 public class PrimerSelectionDialog
extends
29 AbstractFilteredCdmResourceSelectionDialog
<Primer
> {
31 public static Primer
select(Shell shell
, //ConversationHolder conversation,
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,
43 boolean multi
, String settings
, Primer cdmObject
) {
44 super(shell
, //conversation,
45 title
, multi
, settings
, cdmObject
);
50 protected Primer
getPersistentObject(UUID uuid
) {
51 Object object
= CdmStore
.getService(IPrimerService
.class).load(uuid
);
53 Primer primer
= (Primer
) HibernateProxyHelper
.deproxy(object
);
58 MessagingUtils
.error(this.getClass(), "Selected element is not a primer", null);
64 protected void callService(String pattern
) {
65 model
= CdmStore
.getService(IPrimerService
.class).getPrimerUuidAndTitleCache(limitOfInitialElements
, pattern
);
69 * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getTitle(eu.etaxonomy.cdm.model.common.ICdmBase)
72 protected String
getTitle(Primer cdmObject
) {
74 return cdmObject
.getLabel();
76 return super.getTitle(cdmObject
);
81 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
82 return new NewPrimerWizard();
87 protected String
[] getNewWizardText() {
88 return new String
[]{"New Primer"};