Project

General

Profile

Download (2.34 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.navigation.navigator;
11

    
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;
19

    
20
import eu.etaxonomy.cdm.model.taxon.Classification;
21
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
22

    
23
/**
24
 * <p>ClassificationLabelProvider class.</p>
25
 *
26
 * @author n.hoffmann
27
 * @created 17.06.2009
28
 * @version 1.0
29
 */
30
public class ClassificationLabelProvider extends ColumnLabelProvider 
31
implements ILabelProvider, IDescriptionProvider, IStyledLabelProvider {
32
	private static final Logger logger = Logger
33
			.getLogger(ClassificationLabelProvider.class);
34
	
35
	/* (non-Javadoc)
36
	 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
37
	 */
38
	/** {@inheritDoc} */
39
	@Override
40
	public Image getImage(Object element) {
41
		return null;
42
	}
43

    
44
	/* (non-Javadoc)
45
	 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
46
	 */
47
	/** {@inheritDoc} */
48
	@Override
49
	public String getText(Object element) {
50
		if(element instanceof Classification){
51
			String text = ((Classification) element).getName().getText();
52
			return text != null ? text : Messages.ClassificationLabelProvider_UNNAMED_TREE;
53
		}
54
		return new String();
55
	}
56
	
57
	/* (non-Javadoc)
58
	 * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
59
	 */
60
	/** {@inheritDoc} */
61
	public String getDescription(Object anElement) {
62
		if (anElement instanceof Classification) {
63
			return "Taxonomic Tree: " +  ((Classification) anElement).getTitleCache(); //$NON-NLS-1$
64
		}
65
		return null;
66
	}
67

    
68
	/* (non-Javadoc)
69
	 * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
70
	 */
71
	/** {@inheritDoc} */
72
	public StyledString getStyledText(Object element) {
73
		return new StyledString(getText(element), StyledString.DECORATIONS_STYLER);
74
	}
75
}
(2-2/21)