Add predefined Velocity and CSS templates if wiki builder is assigned to a project
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / bookmark / BookmarkLabelProvider.java
1 package com.quantum.view.bookmark;
2
3 import org.eclipse.jface.viewers.ILabelProvider;
4 import org.eclipse.jface.viewers.ILabelProviderListener;
5 import org.eclipse.swt.graphics.Image;
6
7 /**
8  * @author root
9  *
10  * Implements the ILabelProvider for the Bookmarks.
11  */
12 public class BookmarkLabelProvider implements ILabelProvider {
13     
14     private LabelDecorationInstructions labelDecorationInstructions = new LabelDecorationInstructions();
15     
16         /**
17          * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object)
18          */
19         public Image getImage(Object element) {
20         if (element != null && element instanceof TreeNode) {
21             return ((TreeNode) element).getImage();
22         } else {
23             return null;
24         }
25         }
26
27         /**
28          * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object)
29          */
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;
37             }
38                         return labelName;
39                 } else {
40             return element == null ? "<<empty>>" : element.toString();
41         }
42         }
43
44         /**
45          * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener)
46          */
47         public void addListener(ILabelProviderListener listener) {
48         }
49
50         /**
51          * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
52          */
53         public void dispose() {
54         }
55
56         /**
57          * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String)
58          */
59         public boolean isLabelProperty(Object element, String property) {
60                 return false;
61         }
62
63         /**
64          * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener)
65          */
66         public void removeListener(ILabelProviderListener listener) {
67     }
68     /**
69      * @return
70      */
71     public LabelDecorationInstructions getLabelDecorationInstructions() {
72         return labelDecorationInstructions;
73     }
74 }