3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.navigation
.navigator
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
15 import org
.eclipse
.jface
.viewers
.DelegatingStyledCellLabelProvider
.IStyledLabelProvider
;
16 import org
.eclipse
.jface
.viewers
.ILabelProvider
;
17 import org
.eclipse
.jface
.viewers
.StyledString
;
18 import org
.eclipse
.swt
.graphics
.Image
;
19 import org
.eclipse
.ui
.navigator
.IDescriptionProvider
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
24 * <p>ClassificationLabelProvider class.</p>
30 public class ClassificationLabelProvider
extends ColumnLabelProvider
31 implements ILabelProvider
, IDescriptionProvider
, IStyledLabelProvider
{
32 private static final Logger logger
= Logger
33 .getLogger(ClassificationLabelProvider
.class);
36 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
40 public Image
getImage(Object element
) {
45 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
49 public String
getText(Object element
) {
50 if(element
instanceof Classification
){
51 String text
= ((Classification
) element
).getName().getText();
52 return text
!= null ? text
: "Unnamed Taxonomic Tree";
58 * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
61 public String
getDescription(Object anElement
) {
62 if (anElement
instanceof Classification
) {
63 return "Taxonomic Tree: " + ((Classification
) anElement
).getTitleCache(); //$NON-NLS-1$
69 * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
72 public StyledString
getStyledText(Object element
) {
73 return new StyledString(getText(element
), StyledString
.DECORATIONS_STYLER
);