1 |
3be6ef3e
|
n.hoffmann
|
/**
|
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 |
f6a8dc56
|
Patric Plitzner
|
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
15 |
3be6ef3e
|
n.hoffmann
|
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.Synonym;
|
21 |
|
|
|
22 |
|
|
/**
|
23 |
|
|
* @author p.ciardelli
|
24 |
|
|
* @created 02.06.2009
|
25 |
|
|
* @version 1.0
|
26 |
|
|
*/
|
27 |
|
|
/**
|
28 |
|
|
* <p>SynonymLabelProvider class.</p>
|
29 |
|
|
*
|
30 |
|
|
* @author p.ciardelli
|
31 |
|
|
* @created 04.06.2009
|
32 |
|
|
* @version 1.0
|
33 |
|
|
*/
|
34 |
|
|
public class SynonymLabelProvider extends ColumnLabelProvider
|
35 |
|
|
implements ILabelProvider, IDescriptionProvider, IStyledLabelProvider {
|
36 |
|
|
private static final Logger logger = Logger
|
37 |
|
|
.getLogger(SynonymLabelProvider.class);
|
38 |
|
|
|
39 |
|
|
/** {@inheritDoc} */
|
40 |
|
|
public Image getImage(Object element) {
|
41 |
|
|
return null;
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
/** {@inheritDoc} */
|
45 |
|
|
public String getText(Object element) {
|
46 |
|
|
if (element instanceof Synonym &&
|
47 |
|
|
((Synonym) element).getName() != null) {
|
48 |
|
|
|
49 |
939829bc
|
Patrick Plitzner
|
return "= " + ((Synonym) element).getName().getTitleCache(); //$NON-NLS-1$
|
50 |
3be6ef3e
|
n.hoffmann
|
}
|
51 |
|
|
return new String();
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
/* (non-Javadoc)
|
55 |
|
|
* @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
|
56 |
|
|
*/
|
57 |
|
|
/** {@inheritDoc} */
|
58 |
|
|
public String getDescription(Object anElement) {
|
59 |
|
|
if (anElement instanceof Synonym) {
|
60 |
|
|
Synonym data = (Synonym) anElement;
|
61 |
|
|
return "Synonym: " + data.getTitleCache(); //$NON-NLS-1$
|
62 |
|
|
}
|
63 |
|
|
return null;
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
/* (non-Javadoc)
|
67 |
|
|
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
|
68 |
|
|
*/
|
69 |
|
|
/** {@inheritDoc} */
|
70 |
|
|
public StyledString getStyledText(Object element) {
|
71 |
|
|
return new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
|
72 |
|
|
}
|
73 |
|
|
}
|