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
.dialogs
.filteredSelection
;
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 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
59 protected Feature
getPersistentObject(UUID uuid
) {
61 DefinedTermBase term
= CdmStore
.getService(ITermService
.class).load(uuid
);
63 if(term
instanceof Feature
){
64 return (Feature
) term
;
71 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
74 protected void initModel() {
75 List
<Feature
> features
= CdmStore
.getService(ITermService
.class).listByTermClass(Feature
.class, null, null, null, null);
77 List
<UuidAndTitleCache
<Feature
>> featureUuidAndTitleCache
= new ArrayList
<UuidAndTitleCache
<Feature
>>();
79 for(Feature feature
: features
){
80 UuidAndTitleCache
<Feature
> uuidAndTitleCache
= new UuidAndTitleCache
<Feature
>(Feature
.class, feature
.getUuid(), feature
.getTitleCache());
81 featureUuidAndTitleCache
.add(uuidAndTitleCache
);
84 model
= featureUuidAndTitleCache
;
88 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
91 protected String
getNewWizardLinkText() {
96 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard()
99 protected AbstractNewEntityWizard
getNewEntityWizard(String parameter
) {