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.Composite;
|
15
|
import org.eclipse.swt.widgets.Control;
|
16
|
import org.eclipse.swt.widgets.Shell;
|
17
|
import org.eclipse.swt.widgets.Text;
|
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
|
Control control = getPatternControl();
|
119
|
String pattern = null;
|
120
|
if (control != null){
|
121
|
pattern = ((Text)control).getText();
|
122
|
}
|
123
|
|
124
|
if (pattern.equals("?")){
|
125
|
model = CdmStore.getService(IClassificationService.class).getUuidAndTitleCache(null, null);
|
126
|
}else{
|
127
|
model = CdmStore.getService(IClassificationService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
|
128
|
}
|
129
|
|
130
|
}
|
131
|
|
132
|
/** {@inheritDoc} */
|
133
|
@Override
|
134
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
135
|
return null;
|
136
|
}
|
137
|
|
138
|
/** {@inheritDoc} */
|
139
|
@Override
|
140
|
protected String getNewWizardLinkText() {
|
141
|
return null;
|
142
|
}
|
143
|
}
|