1 package net.sf.panoptes.view;
2
3 import net.sf.panoptes.model.component.Component;
4
5 import org.eclipse.jface.viewers.ITreeContentProvider;
6 import org.eclipse.jface.viewers.Viewer;
7
8 /***
9 * TroodonTreeContentProvider.java
10 *
11 * @author Dag Liodden
12 * @version 0.1
13 */
14 public class TreeContentProvider implements ITreeContentProvider {
15
16 public static final String root = "ROOT";
17
18 /***
19 * Constructor for TroodonTreeContentProvider.
20 */
21 public TreeContentProvider() {
22 super();
23 }
24
25 /***
26 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
27 */
28 public Object[] getChildren(Object parentElement) {
29
30 Object[] kids = null;
31
32 if (parentElement instanceof Component) {
33 kids = ((Component) parentElement).getChildren();
34 }
35
36 return kids == null ? new Object[0] : kids;
37
38 }
39
40 /***
41 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
42 */
43 public Object getParent(Object element) {
44 return null;
45 }
46
47 /***
48 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
49 */
50 public boolean hasChildren(Object element) {
51 return getChildren(element).length > 0;
52 }
53
54 /***
55 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
56 */
57 public Object[] getElements(Object inputElement) {
58 return getChildren(inputElement);
59 }
60
61 /***
62 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
63 */
64 public void dispose() {
65 }
66
67 /***
68 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
69 */
70 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
71 }
72
73 }
This page was automatically generated by Maven