1 package net.sf.panoptes.view;
2
3 import net.sf.panoptes.model.node.Node;
4
5 import org.eclipse.jface.viewers.ILabelProvider;
6 import org.eclipse.jface.viewers.ILabelProviderListener;
7 import org.eclipse.swt.graphics.Image;
8
9 /***
10 * TreeLabelProvider.java
11 *
12 * @author Dag Liodden
13 * @version 0.1
14 */
15 public class TreeLabelProvider implements ILabelProvider {
16
17 /***
18 * Constructor for TreeLabelProvider.
19 */
20 public TreeLabelProvider() {
21 super();
22 }
23
24 /***
25 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
26 */
27 public Image getImage(Object element) {
28 Image icon = null;
29 if (element instanceof Node)
30 icon = ((Node) element).getIcon();
31 return icon;
32 }
33
34 /***
35 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
36 */
37 public String getText(Object element) {
38 if (element instanceof Node) {
39 Node conf = (Node) element;
40 int count = conf.getChildren().length;
41 return conf.getConfigDescriptor().getName() + (count == 0 ? "" : " (" + count + ")");
42 } else {
43 return element.toString();
44 }
45
46 }
47
48 /***
49 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
50 */
51 public void addListener(ILabelProviderListener listener) {
52 }
53
54 /***
55 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
56 */
57 public void dispose() {
58 }
59
60 /***
61 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
62 */
63 public boolean isLabelProperty(Object element, String property) {
64 return false;
65 }
66
67 /***
68 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
69 */
70 public void removeListener(ILabelProviderListener listener) {
71 }
72
73 }
This page was automatically generated by Maven