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.featuretree;
|
12
|
|
13
|
import org.eclipse.jface.viewers.LabelProvider;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.description.Feature;
|
16
|
import eu.etaxonomy.cdm.model.description.FeatureNode;
|
17
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
18
|
|
19
|
/**
|
20
|
* <p>FeatureTreeLabelProvider class.</p>
|
21
|
*
|
22
|
* @author n.hoffmann
|
23
|
* @created Aug 5, 2010
|
24
|
* @version 1.0
|
25
|
*/
|
26
|
public class FeatureTreeLabelProvider extends LabelProvider {
|
27
|
|
28
|
private Feature feature;
|
29
|
|
30
|
/** {@inheritDoc} */
|
31
|
@Override
|
32
|
public String getText(Object element) {
|
33
|
if(element instanceof FeatureTree){
|
34
|
return ((FeatureTree) element).getTitleCache();
|
35
|
}else if(element instanceof FeatureNode){
|
36
|
feature = ((FeatureNode) element).getFeature();
|
37
|
|
38
|
if(feature != null)
|
39
|
return feature.getTitleCache();
|
40
|
|
41
|
}
|
42
|
return "No label provided";
|
43
|
}
|
44
|
|
45
|
/**
|
46
|
* <p>Getter for the field <code>feature</code>.</p>
|
47
|
*
|
48
|
* @return a {@link eu.etaxonomy.cdm.model.description.Feature} object.
|
49
|
*/
|
50
|
public Feature getFeature(){
|
51
|
return feature;
|
52
|
}
|
53
|
}
|