Project

General

Profile

Download (1.93 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.ui.dialog.selection;
12

    
13
import java.util.UUID;
14

    
15
import org.eclipse.swt.widgets.Shell;
16

    
17
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18
import eu.etaxonomy.cdm.api.service.INameService;
19
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
20
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
21
import eu.etaxonomy.taxeditor.newWizard.NewNonViralNameWizard;
22
import eu.etaxonomy.taxeditor.store.CdmStore;
23

    
24
/**
25
 * @author n.hoffmann
26
 * @created 04.06.2009
27
 * @version 1.0
28
 */
29
public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNameBase> {
30

    
31
	public static TaxonNameBase select(Shell shell, ConversationHolder conversation, TaxonNameBase name) {
32
		NameSelectionDialog dialog = new NameSelectionDialog(shell, conversation,
33
				"Choose a name", false, name);
34
		return getSelectionFromDialog(dialog);
35
	}
36

    
37
	protected NameSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonNameBase name) {
38
		super(shell, conversation, title, multi, NameSelectionDialog.class.getCanonicalName(), name);
39
	}
40

    
41
	/** {@inheritDoc} */
42
	@Override
43
	protected TaxonNameBase getPersistentObject(UUID cdmUuid) {
44
		return CdmStore.getService(INameService.class).load(cdmUuid);
45
	}
46

    
47
	/** {@inheritDoc} */
48
	@Override
49
	protected void initModel() {
50
		model = CdmStore.getService(INameService.class).getUuidAndTitleCache();
51
	}
52

    
53
	/** {@inheritDoc} */
54
	@Override
55
	protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
56
		return new NewNonViralNameWizard();
57
	}
58

    
59
	/** {@inheritDoc} */
60
	@Override
61
	protected String getNewWizardLinkText() {
62
		return String.format("Create a new <a>%1s</a>", "Name ");
63
	}
64
}
(15-15/31)