1 package com.quantum.view.bookmark;
3 import org.eclipse.jface.viewers.ILabelProvider;
4 import org.eclipse.jface.viewers.ILabelProviderListener;
5 import org.eclipse.swt.graphics.Image;
10 * Implements the ILabelProvider for the Bookmarks.
12 public class BookmarkLabelProvider implements ILabelProvider {
14 private LabelDecorationInstructions labelDecorationInstructions = new LabelDecorationInstructions();
17 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object)
19 public Image getImage(Object element) {
20 if (element != null && element instanceof TreeNode) {
21 return ((TreeNode) element).getImage();
28 * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object)
30 public String getText(Object element) {
31 if (element != null && element instanceof TreeNode) {
32 String labelName = ((TreeNode) element).getLabelName();
33 String decorations = ((TreeNode) element).getLabelDecorations(
34 this.labelDecorationInstructions);
35 if (decorations != null && decorations.trim().length() > 0) {
36 labelName += " " + decorations;
40 return element == null ? "<<empty>>" : element.toString();
45 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener)
47 public void addListener(ILabelProviderListener listener) {
51 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
53 public void dispose() {
57 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String)
59 public boolean isLabelProperty(Object element, String property) {
64 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener)
66 public void removeListener(ILabelProviderListener listener) {
71 public LabelDecorationInstructions getLabelDecorationInstructions() {
72 return labelDecorationInstructions;