use the CdmFilteredSelectionDialog
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / ClassificationSelectionDialog.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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
11 package eu.etaxonomy.taxeditor.ui.dialog.selection;
12
13 import java.util.UUID;
14
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.Control;
17 import org.eclipse.swt.widgets.Shell;
18 import org.eclipse.swt.widgets.Text;
19
20 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
21 import eu.etaxonomy.cdm.api.service.IClassificationService;
22 import eu.etaxonomy.cdm.model.taxon.Classification;
23 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
24 import eu.etaxonomy.taxeditor.store.CdmStore;
25
26 /**
27 * <p>
28 * FilteredClassificationSelectionDialog class.
29 * </p>
30 *
31 * @author n.hoffmann
32 * @created Sep 21, 2009
33 * @version 1.0
34 */
35 public class ClassificationSelectionDialog extends
36 AbstractFilteredCdmResourceSelectionDialog<Classification> {
37
38 /**
39 * <p>
40 * select
41 * </p>
42 *
43 * @param shell
44 * a {@link org.eclipse.swt.widgets.Shell} object.
45 * @param conversation
46 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
47 * object.
48 * @param curentSelection
49 * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
50 */
51 public static Classification select(Shell shell,
52 ConversationHolder conversation, Classification curentSelection) {
53 ClassificationSelectionDialog dialog = new ClassificationSelectionDialog(
54 shell, conversation, "Choose a Classification", false, "", null);
55 return getSelectionFromDialog(dialog);
56 }
57
58 /**
59 * <p>
60 * Constructor for FilteredClassificationSelectionDialog.
61 * </p>
62 *
63 * @param shell
64 * a {@link org.eclipse.swt.widgets.Shell} object.
65 * @param title
66 * a {@link java.lang.String} object.
67 * @param multi
68 * a boolean.
69 * @param settings
70 * a {@link java.lang.String} object.
71 * @param conversation
72 * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
73 * object.
74 * @param classification
75 * a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
76 */
77 protected ClassificationSelectionDialog(Shell shell,
78 ConversationHolder conversation, String title, boolean multi,
79 String settings, Classification classification) {
80 super(shell, conversation, title, multi, settings, classification);
81 }
82
83 /*
84 * (non-Javadoc)
85 *
86 * @see
87 * org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea
88 * (org.eclipse.swt.widgets.Composite)
89 */
90 /** {@inheritDoc} */
91 @Override
92 protected Control createExtendedContentArea(Composite parent) {
93 return null;
94 }
95
96 /*
97 * (non-Javadoc)
98 *
99 * @see
100 * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog
101 * #getPersistentObject(java.util.UUID)
102 */
103 /** {@inheritDoc} */
104 @Override
105 protected Classification getPersistentObject(UUID cdmUuid) {
106 return CdmStore.getService(IClassificationService.class).load(cdmUuid);
107 }
108
109 /*
110 * (non-Javadoc)
111 *
112 * @see
113 * eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog
114 * #initModel()
115 */
116 /** {@inheritDoc} */
117 @Override
118 protected void initModel() {
119 Control control = getPatternControl();
120 String pattern = null;
121 if (control != null){
122 pattern = ((Text)control).getText();
123 }
124
125
126 model = CdmStore.getService(IClassificationService.class)
127 .getUuidAndTitleCache(limitOfInitialElements, pattern);
128 }
129
130 /** {@inheritDoc} */
131 @Override
132 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
133 return null;
134 }
135
136 /** {@inheritDoc} */
137 @Override
138 protected String getNewWizardLinkText() {
139 return null;
140 }
141 }