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
.dialogs
.filteredSelection
;
13 import java
.util
.UUID
;
15 import org
.eclipse
.swt
.widgets
.Shell
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
19 import eu
.etaxonomy
.taxeditor
.editor
.newWizard
.AbstractNewEntityWizard
;
20 import eu
.etaxonomy
.taxeditor
.editor
.newWizard
.NewNonViralNameWizard
;
21 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
24 * <p>FilteredNameSelectionDialog class.</p>
30 public class FilteredNameSelectionDialog
extends AbstractFilteredCdmResourceSelectionDialog
<TaxonNameBase
> {
33 * Creates a filtered selection dialog to select a name.
36 * The shell for displaying this widget
38 * A name that should be selected when the dialog opens
39 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
40 * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
42 public static TaxonNameBase
select(Shell shell
, ConversationHolder conversation
, TaxonNameBase name
) {
43 FilteredNameSelectionDialog dialog
= new FilteredNameSelectionDialog(shell
, conversation
,
44 "Choose a name", false, name
);
45 return getSelectionFromDialog(dialog
);
49 * <p>Constructor for FilteredNameSelectionDialog.</p>
51 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
52 * @param title a {@link java.lang.String} object.
53 * @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
54 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
55 * @param multi a boolean.
57 protected FilteredNameSelectionDialog(Shell shell
, ConversationHolder conversation
, String title
, boolean multi
, TaxonNameBase name
) {
58 super(shell
, conversation
, title
, multi
, FilteredNameSelectionDialog
.class.getCanonicalName(), name
);
62 * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
66 protected TaxonNameBase
getPersistentObject(UUID cdmUuid
) {
67 return CdmStore
.getNameService().load(cdmUuid
);
71 * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()
75 protected void initModel() {
76 model
= CdmStore
.getNameService().getUuidAndTitleCache();
81 protected AbstractNewEntityWizard
getNewEntityWizard() {
82 return new NewNonViralNameWizard();
87 protected String
getNewWizardLinkText() {
88 return "Click <A>here</A> to create a new name.";