Project

General

Profile

Download (2.07 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.navigation.navigator;
12

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

    
21
import eu.etaxonomy.cdm.model.taxon.Synonym;
22

    
23
/**
24
 * @author p.ciardelli
25
 * @created 02.06.2009
26
 * @version 1.0
27
 */
28
/**
29
 * <p>SynonymLabelProvider class.</p>
30
 *
31
 * @author p.ciardelli
32
 * @created 04.06.2009
33
 * @version 1.0
34
 */
35
public class SynonymLabelProvider extends ColumnLabelProvider 
36
		implements ILabelProvider, IDescriptionProvider, IStyledLabelProvider {
37
	private static final Logger logger = Logger
38
			.getLogger(SynonymLabelProvider.class);
39
	
40
	/** {@inheritDoc} */
41
	public Image getImage(Object element) {
42
		return null;
43
	}
44

    
45
	/** {@inheritDoc} */
46
	public String getText(Object element) {
47
		if (element instanceof Synonym &&
48
				((Synonym) element).getName() != null) {
49
			
50
			return "= " + ((Synonym) element).getName().getTitleCache();
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 Synonym) {
61
			Synonym data = (Synonym) anElement;
62
			return "Synonym: " + data.getTitleCache(); //$NON-NLS-1$
63
		}
64
		return null;
65
	}
66

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