2 * Copyright (C) 2007 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.
10 package eu
.etaxonomy
.taxeditor
.featuretree
;
12 import java
.util
.ArrayList
;
14 import org
.eclipse
.jface
.viewers
.LabelProvider
;
16 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
17 import eu
.etaxonomy
.cdm
.model
.common
.Representation
;
18 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
19 import eu
.etaxonomy
.cdm
.model
.description
.FeatureNode
;
20 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
21 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
26 * @created Aug 5, 2010
29 public class FeatureTreeLabelProvider
extends LabelProvider
{
33 public String
getText(Object element
) {
34 if(element
instanceof FeatureTree
){
35 return ((FeatureTree
) element
).getTitleCache();
36 }else if(element
instanceof FeatureNode
){
37 Feature feature
= ((FeatureNode
) element
).getFeature();
39 Representation rep
= feature
.getRepresentation(PreferencesUtil
.getGlobalLanguage());
41 rep
= feature
.getPreferredRepresentation(new ArrayList
<Language
>());
43 return rep
!= null? rep
.getLabel() : feature
.getTitleCache();
47 return "No label provided";