2 * Copyright (C) 2009 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.
9 package eu
.etaxonomy
.taxeditor
.ui
.selection
;
11 import org
.eclipse
.swt
.events
.SelectionEvent
;
13 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
14 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
15 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
17 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.TaxonNodeSelectionDialog
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
26 public class TaxonNodeSelectionElement
extends EntitySelectionElement
<TaxonNode
> {
28 private Classification classification
;
30 public TaxonNodeSelectionElement(CdmFormFactory formFactory
,
31 ConversationHolder conversation
, ICdmFormElement parentElement
,
32 String labelString
, TaxonNode entity
, int mode
, int style
) {
33 super(formFactory
, conversation
, parentElement
, TaxonNode
.class, labelString
, entity
, mode
,
40 public Classification
getClassification() {
41 return classification
;
44 public void setClassification(Classification classification
){
45 this.classification
= classification
;
52 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
53 * .events.SelectionEvent)
57 public void widgetSelected(SelectionEvent e
) {
58 TaxonNode newSelection
= TaxonNodeSelectionDialog
.select(getShell(),
59 getConversationHolder(), "Select parent taxon", null, null, getClassification());
60 setSelectionInternal(newSelection
);
67 * eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
72 protected String
getTitle() {
73 if (getEntity() != null && getEntity().getTaxon() != null) {
74 return CdmUtils
.Nz(getEntity().getTaxon().getTitleCache());
76 return super.getTitle();