2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
12 import java
.util
.UUID
;
14 import org
.eclipse
.swt
.widgets
.Shell
;
16 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
17 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
18 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
19 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
20 import eu
.etaxonomy
.taxeditor
.newWizard
.NewFeatureVocabularyWizard
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class TermVocabularySelectionDialog
extends
30 AbstractFilteredCdmResourceSelectionDialog
<TermVocabulary
> {
32 private TermType termType
;
34 public static TermVocabulary
select(String dialogTitle
, Shell shell
, TermVocabulary voc
, TermType termType
){
35 return select_internal(dialogTitle
, shell
, voc
, termType
);
38 public static TermVocabulary
select(String dialogTitle
, Shell shell
, TermVocabulary voc
){
39 return select_internal(dialogTitle
, shell
, voc
, null);
42 public static TermVocabulary
select(Shell shell
, TermVocabulary voc
){
43 return select_internal("Choose Vocabulary", shell
, voc
, null);
46 private static TermVocabulary
select_internal(String dialogTitle
, Shell shell
, TermVocabulary voc
,
48 TermVocabularySelectionDialog dialog
= new TermVocabularySelectionDialog(shell
,
49 dialogTitle
!=null?dialogTitle
:"Choose Vocabulary",
51 TermVocabularySelectionDialog
.class.getCanonicalName(),
53 return getSelectionFromDialog(dialog
);
56 protected TermVocabularySelectionDialog(Shell shell
,
57 String title
, boolean multi
,
58 String settings
, TermVocabulary cdmObject
, TermType termType
) {
59 super(shell
, title
, multi
, settings
, cdmObject
);
60 this.termType
= termType
;
64 protected TermVocabulary
getPersistentObject(UUID uuid
) {
65 return CdmStore
.getService(IVocabularyService
.class).load(uuid
);
69 protected void callService(String pattern
) {
70 model
= CdmStore
.getService(IVocabularyService
.class).getUuidAndTitleCache(TermVocabulary
.class, termType
, limitOfInitialElements
, pattern
);
74 protected String
[] getNewWizardText() {
75 return new String
[]{ "New Vocabulary"};
79 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {
80 return new NewFeatureVocabularyWizard();