Project

General

Profile

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

    
10
package eu.etaxonomy.taxeditor.featuretree;
11

    
12
import org.eclipse.jface.viewers.LabelProvider;
13

    
14
import eu.etaxonomy.cdm.model.description.Feature;
15
import eu.etaxonomy.cdm.model.description.FeatureNode;
16
import eu.etaxonomy.cdm.model.description.FeatureTree;
17

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