1 |
729887cf
|
n.hoffmann
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
f0a072ff
|
Patric Plitzner
|
* European Distributed Institute of Taxonomy
|
4 |
729887cf
|
n.hoffmann
|
* http://www.e-taxonomy.eu
|
5 |
f0a072ff
|
Patric Plitzner
|
*
|
6 |
729887cf
|
n.hoffmann
|
* 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 |
78222507
|
n.hoffmann
|
package eu.etaxonomy.taxeditor.ui.dialog.selection;
|
11 |
729887cf
|
n.hoffmann
|
|
12 |
|
|
import java.util.UUID;
|
13 |
|
|
|
14 |
|
|
import org.eclipse.swt.widgets.Shell;
|
15 |
|
|
|
16 |
db5e366d
|
n.hoffmann
|
import eu.etaxonomy.cdm.api.service.INameService;
|
17 |
e3a4a3ff
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
18 |
f211dd28
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
|
19 |
|
|
import eu.etaxonomy.taxeditor.newWizard.NewNonViralNameWizard;
|
20 |
729887cf
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
21 |
|
|
|
22 |
|
|
/**
|
23 |
|
|
* @author n.hoffmann
|
24 |
|
|
* @created 04.06.2009
|
25 |
|
|
*/
|
26 |
e3a4a3ff
|
Andreas Müller
|
public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonName> {
|
27 |
729887cf
|
n.hoffmann
|
|
28 |
f5979052
|
Katja Luther
|
public static TaxonName select(Shell shell, //ConversationHolder conversation,
|
29 |
|
|
TaxonName name) {
|
30 |
|
|
NameSelectionDialog dialog = new NameSelectionDialog(shell, //conversation,
|
31 |
729887cf
|
n.hoffmann
|
"Choose a name", false, name);
|
32 |
|
|
return getSelectionFromDialog(dialog);
|
33 |
|
|
}
|
34 |
f0a072ff
|
Patric Plitzner
|
|
35 |
f5979052
|
Katja Luther
|
protected NameSelectionDialog(Shell shell, //ConversationHolder conversation,
|
36 |
|
|
String title, boolean multi, TaxonName name) {
|
37 |
|
|
super(shell, //conversation,
|
38 |
|
|
title, multi, NameSelectionDialog.class.getCanonicalName(), name);
|
39 |
729887cf
|
n.hoffmann
|
}
|
40 |
|
|
|
41 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
42 |
729887cf
|
n.hoffmann
|
@Override
|
43 |
e3a4a3ff
|
Andreas Müller
|
protected TaxonName getPersistentObject(UUID cdmUuid) {
|
44 |
db5e366d
|
n.hoffmann
|
return CdmStore.getService(INameService.class).load(cdmUuid);
|
45 |
729887cf
|
n.hoffmann
|
}
|
46 |
|
|
|
47 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
48 |
0ce80af9
|
Katja Luther
|
// @Override
|
49 |
|
|
// protected void search() {
|
50 |
|
|
// Control control =getSearchField();
|
51 |
|
|
// String pattern = null;
|
52 |
|
|
// if (control != null){
|
53 |
|
|
// pattern = ((Text)control).getText();
|
54 |
|
|
// }
|
55 |
|
|
//
|
56 |
|
|
// if (pattern.equals("?")){
|
57 |
|
|
// model = CdmStore.getService(INameService.class).getUuidAndTitleCache(null, null);
|
58 |
|
|
// }else if (pattern != null){
|
59 |
|
|
// model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
|
60 |
|
|
// }
|
61 |
|
|
// }
|
62 |
2d9a13f7
|
n.hoffmann
|
|
63 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
64 |
2d9a13f7
|
n.hoffmann
|
@Override
|
65 |
9a0f58cd
|
n.hoffmann
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
66 |
2d9a13f7
|
n.hoffmann
|
return new NewNonViralNameWizard();
|
67 |
|
|
}
|
68 |
|
|
|
69 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
70 |
2d9a13f7
|
n.hoffmann
|
@Override
|
71 |
5aeccadc
|
Katja Luther
|
protected String[] getNewWizardText() {
|
72 |
0ce80af9
|
Katja Luther
|
return new String[]{"New Name"};
|
73 |
2d9a13f7
|
n.hoffmann
|
}
|
74 |
0ce80af9
|
Katja Luther
|
|
75 |
|
|
/* (non-Javadoc)
|
76 |
|
|
* @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#callService(java.lang.String)
|
77 |
|
|
*/
|
78 |
|
|
@Override
|
79 |
|
|
void callService(String pattern) {
|
80 |
|
|
model = CdmStore.getService(INameService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
|
81 |
|
|
}
|
82 |
729887cf
|
n.hoffmann
|
}
|