*** empty log message ***
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / widget / SimpleLabelProvider.java
1 package com.quantum.view.widget;
2
3 import com.quantum.model.Displayable;
4
5 import org.eclipse.jface.viewers.LabelProvider;
6 import org.eclipse.swt.graphics.Image;
7
8
9 /**
10  * @author BC
11  */
12 public class SimpleLabelProvider extends LabelProvider {
13         
14         private final Image image;
15         
16         public SimpleLabelProvider() {
17                 this(null);
18         }
19         public SimpleLabelProvider(Image image) {
20                 this.image = image;
21         }
22         public Image getImage(Object element) {
23                 return this.image;
24         }
25         public String getText(Object element) {
26                 if (element instanceof Displayable) {
27                         return ((Displayable) element).getDisplayName();
28                 } else {
29                         return super.getText(element);
30                 }
31         }
32 }