Merge branch 'release/5.5.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / FeatureSelectionDialog.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
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.ITermService;
17 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
18 import eu.etaxonomy.cdm.model.description.Feature;
19 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
20 import eu.etaxonomy.taxeditor.store.CdmStore;
21
22 /**
23 * @author n.hoffmann
24 * @created Dec 6, 2010
25 * @version 1.0
26 */
27 public class FeatureSelectionDialog extends
28 AbstractFilteredCdmResourceSelectionDialog<Feature> {
29
30 public static Feature select(Shell shell, //ConversationHolder conversation,
31 Feature feature){
32 FeatureSelectionDialog dialog = new FeatureSelectionDialog(shell, //conversation,
33 "Choose Feature", false, FeatureSelectionDialog.class.getCanonicalName(), feature);
34 return getSelectionFromDialog(dialog);
35 }
36
37 /**
38 * @param shell
39 * @param conversation
40 * @param title
41 * @param multi
42 * @param settings
43 * @param cdmObject
44 */
45 protected FeatureSelectionDialog(Shell shell,//ConversationHolder conversation,
46 String title, boolean multi,
47 String settings, Feature cdmObject) {
48 super(shell,//conversation,
49 title, multi, settings, cdmObject);
50 }
51
52 @Override
53 protected Feature getPersistentObject(UUID uuid) {
54
55 DefinedTermBase<?> term = CdmStore.getService(ITermService.class).load(uuid);
56
57 if(term instanceof Feature){
58 return (Feature) term;
59 }
60
61 return null;
62 }
63
64 @Override
65 protected void callService(String pattern) {
66 model = CdmStore.getService(ITermService.class).getUuidAndTitleCache(Feature.class, limitOfInitialElements, pattern);
67 }
68
69 /* (non-Javadoc)
70 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
71 */
72 @Override
73 protected String[] getNewWizardText() {
74 return null;
75 }
76
77 /* (non-Javadoc)
78 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard()
79 */
80 @Override
81 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
82 return null;
83 }
84
85 }