Merge branch 'release/5.10.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / TaxonSelectionDialog.java
1 // $Id$
2 /**
3 * Copyright (C) 2018 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.taxeditor.ui.dialog.selection;
11
12 import java.util.UUID;
13
14 import org.eclipse.swt.widgets.Shell;
15
16 import eu.etaxonomy.cdm.api.service.ITaxonService;
17 import eu.etaxonomy.cdm.model.taxon.Taxon;
18 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
19 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
20 import eu.etaxonomy.taxeditor.newWizard.NewTaxonWizard;
21 import eu.etaxonomy.taxeditor.store.CdmStore;
22
23 /**
24 * @author k.luther
25 * @date 09.03.2018
26 *
27 */
28 public class TaxonSelectionDialog extends TaxonBaseSelectionDialog<Taxon> {
29
30
31
32 /**
33 * @param clazz
34 * @param shell
35 * @param title
36 * @param multi
37 * @param taxon
38 * @param taxonToBeFiltered
39 */
40 protected TaxonSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell, String title, boolean multi,
41 TaxonBase taxon, TaxonBase taxonToBeFiltered) {
42 super(clazz, shell, title, multi, taxon, taxonToBeFiltered);
43 // TODO Auto-generated constructor stub
44 }
45
46 public static Taxon selectTaxon(Shell shell, //ConversationHolder conversation,
47 Taxon taxonToBeFiltered) {
48 AbstractFilteredCdmResourceSelectionDialog<Taxon> dialog = new TaxonSelectionDialog(Taxon.class, shell, //conversation,
49 "Choose a taxon", false, null, taxonToBeFiltered);
50 return getSelectionFromDialog(dialog);
51 }
52
53
54 @Override
55 protected void callService(String pattern) {
56 model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache(Taxon.class, limitOfInitialElements, pattern);
57 }
58
59
60 @Override
61 protected Taxon getPersistentObject(UUID uuid) {
62 return (Taxon) CdmStore.getService(ITaxonService.class).load(uuid);
63 }
64
65 /* (non-Javadoc)
66 * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardText()
67 */
68 @Override
69 protected String[] getNewWizardText() {
70 return new String[]{"New Taxon"};
71 }
72
73 /* (non-Javadoc)
74 * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
75 */
76 @Override
77 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
78 return new NewTaxonWizard();
79 }
80
81 }