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
.navigation
.navigator
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
14 import org
.eclipse
.jface
.viewers
.DelegatingStyledCellLabelProvider
.IStyledLabelProvider
;
15 import org
.eclipse
.jface
.viewers
.ILabelProvider
;
16 import org
.eclipse
.jface
.viewers
.StyledString
;
17 import org
.eclipse
.swt
.graphics
.Image
;
18 import org
.eclipse
.ui
.navigator
.IDescriptionProvider
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
23 * <p>ClassificationLabelProvider class.</p>
29 public class ClassificationLabelProvider
extends ColumnLabelProvider
30 implements ILabelProvider
, IDescriptionProvider
, IStyledLabelProvider
{
31 private static final Logger logger
= Logger
32 .getLogger(ClassificationLabelProvider
.class);
35 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
39 public Image
getImage(Object element
) {
44 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
48 public String
getText(Object element
) {
49 if(element
instanceof Classification
){
50 String text
= ((Classification
) element
).getName().getText();
51 return text
!= null ? text
: "Unnamed Taxonomic Tree";
57 * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
60 public String
getDescription(Object anElement
) {
61 if (anElement
instanceof Classification
) {
62 return "Taxonomic Tree: " + ((Classification
) anElement
).getTitleCache(); //$NON-NLS-1$
68 * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
71 public StyledString
getStyledText(Object element
) {
72 return new StyledString(getText(element
), StyledString
.DECORATIONS_STYLER
);