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