Project

General

Profile

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

    
11
package eu.etaxonomy.taxeditor.singlesource.navigation.navigator;
12

    
13
import org.apache.log4j.Logger;
14
import org.eclipse.jface.viewers.ColumnLabelProvider;
15
import org.eclipse.jface.viewers.ILabelProvider;
16
import org.eclipse.swt.graphics.Image;
17
import org.eclipse.ui.navigator.IDescriptionProvider;
18

    
19
import eu.etaxonomy.cdm.model.taxon.Classification;
20

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

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