3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
;
13 import java
.util
.ArrayList
;
14 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import org
.eclipse
.swt
.widgets
.Shell
;
19 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
20 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
21 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
22 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
23 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
24 import eu
.etaxonomy
.taxeditor
.newWizard
.AbstractNewEntityWizard
;
25 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 * @created Dec 6, 2010
32 public class FeatureSelectionDialog
extends
33 AbstractFilteredCdmResourceSelectionDialog
<Feature
> {
35 public static Feature
select(Shell shell
, ConversationHolder conversation
, Feature feature
){
36 FeatureSelectionDialog dialog
= new FeatureSelectionDialog(shell
, conversation
,
37 "Choose Feature", false, FeatureSelectionDialog
.class.getCanonicalName(), feature
);
38 return getSelectionFromDialog(dialog
);
49 protected FeatureSelectionDialog(Shell shell
,
50 ConversationHolder conversation
, String title
, boolean multi
,
51 String settings
, Feature cdmObject
) {
52 super(shell
, conversation
, title
, multi
, settings
, cdmObject
);
56 protected Feature
getPersistentObject(UUID uuid
) {
58 DefinedTermBase
<?
> term
= CdmStore
.getService(ITermService
.class).load(uuid
);
60 if(term
instanceof Feature
){
61 return (Feature
) term
;
68 protected void initModel() {
69 List
<Feature
> features
= CdmStore
.getService(ITermService
.class).list(Feature
.class, null, null, null, null);
71 List
<UuidAndTitleCache
<Feature
>> featureUuidAndTitleCache
= new ArrayList
<UuidAndTitleCache
<Feature
>>();
73 for(Feature feature
: features
){
74 UuidAndTitleCache
<Feature
> uuidAndTitleCache
= new UuidAndTitleCache
<Feature
>(Feature
.class, feature
.getUuid(), feature
.getId(), feature
.getTitleCache());
75 featureUuidAndTitleCache
.add(uuidAndTitleCache
);
78 model
= featureUuidAndTitleCache
;
82 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
85 protected String
getNewWizardLinkText() {
90 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard()
93 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {