2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.navigation
.navigator
;
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
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
28 * <p>SynonymLabelProvider class.</p>
34 public class SynonymLabelProvider
extends ColumnLabelProvider
35 implements ILabelProvider
, IDescriptionProvider
, IStyledLabelProvider
{
36 private static final Logger logger
= Logger
37 .getLogger(SynonymLabelProvider
.class);
40 public Image
getImage(Object element
) {
45 public String
getText(Object element
) {
46 if (element
instanceof Synonym
&&
47 ((Synonym
) element
).getName() != null) {
49 return "= " + ((Synonym
) element
).getName().getTitleCache(); //$NON-NLS-1$
55 * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
58 public String
getDescription(Object anElement
) {
59 if (anElement
instanceof Synonym
) {
60 Synonym data
= (Synonym
) anElement
;
61 return "Synonym: " + data
.getTitleCache(); //$NON-NLS-1$
67 * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
70 public StyledString
getStyledText(Object element
) {
71 return new StyledString(getText(element
), StyledString
.QUALIFIER_STYLER
);