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.IVocabularyService;
|
17
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
18
|
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
|
19
|
import eu.etaxonomy.taxeditor.newWizard.NewVocabularyWizard;
|
20
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
21
|
|
22
|
/**
|
23
|
*
|
24
|
* @author pplitzner
|
25
|
* @since Jun 1, 2018
|
26
|
*
|
27
|
*/
|
28
|
public class TermVocabularySelectionDialog extends
|
29
|
AbstractFilteredCdmResourceSelectionDialog<TermVocabulary> {
|
30
|
|
31
|
public static TermVocabulary select(String dialogTitle, Shell shell, TermVocabulary voc){
|
32
|
return select_internal(dialogTitle, shell, voc);
|
33
|
}
|
34
|
|
35
|
public static TermVocabulary select(Shell shell, TermVocabulary voc){
|
36
|
return select_internal("Choose Vocabulary", shell, voc);
|
37
|
}
|
38
|
|
39
|
private static TermVocabulary select_internal(String dialogTitle, Shell shell, TermVocabulary voc){
|
40
|
TermVocabularySelectionDialog dialog = new TermVocabularySelectionDialog(shell,
|
41
|
dialogTitle!=null?dialogTitle:"Choose Vocabulary",
|
42
|
false,
|
43
|
TermVocabularySelectionDialog.class.getCanonicalName(),
|
44
|
voc);
|
45
|
return getSelectionFromDialog(dialog);
|
46
|
}
|
47
|
|
48
|
protected TermVocabularySelectionDialog(Shell shell,
|
49
|
String title, boolean multi,
|
50
|
String settings, TermVocabulary cdmObject) {
|
51
|
super(shell, title, multi, settings, cdmObject);
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
protected TermVocabulary getPersistentObject(UUID uuid) {
|
56
|
return CdmStore.getService(IVocabularyService.class).load(uuid);
|
57
|
}
|
58
|
|
59
|
@Override
|
60
|
protected void callService(String pattern) {
|
61
|
model = CdmStore.getService(IVocabularyService.class).getUuidAndTitleCache(TermVocabulary.class, limitOfInitialElements, pattern);
|
62
|
}
|
63
|
|
64
|
@Override
|
65
|
protected String[] getNewWizardText() {
|
66
|
return new String[]{ "New Vocabulary"};
|
67
|
}
|
68
|
|
69
|
@Override
|
70
|
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
|
71
|
return new NewVocabularyWizard();
|
72
|
}
|
73
|
|
74
|
}
|