Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / TestPoolContentProvider.java
1 /*************************************************************************
2  * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
3  *
4  * Plugin for PHP unit Testing.
5  * www.phpeclipse.de
6  * 
7  *************************************************************************/
8
9 package net.sourceforge.phpeclipse.phpunit;
10
11 import java.util.Vector;
12
13 import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
14 import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
15
16 import org.eclipse.jface.viewers.ITreeContentProvider;
17 import org.eclipse.jface.viewers.Viewer;
18
19 public class TestPoolContentProvider implements ITreeContentProvider {
20
21         /*
22          * (non-Javadoc)
23          * 
24          * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
25          */
26         public Object[] getChildren(Object parentElement) {
27
28                 if (parentElement instanceof TestSuite) {
29
30                         Vector allChildren = new Vector();
31                         allChildren.addAll(((TestSuite) parentElement).getTestCases());
32                         allChildren.addAll(((TestSuite) parentElement).getTestSuites());
33
34                         return allChildren.toArray();
35
36                 } else {
37                         return new Object[0];
38                 }
39
40         }
41
42         /*
43          * (non-Javadoc)
44          * 
45          * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
46          */
47         public Object getParent(Object element) {
48
49                 if (element instanceof TestSuite)
50                         return ((TestSuite) element).getParent();
51                 else if (element instanceof TestCase)
52                         return ((TestCase) element).getParentSuite();
53                 else
54                         return null;
55         }
56
57         /*
58          * (non-Javadoc)
59          * 
60          * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
61          */
62         public boolean hasChildren(Object element) {
63
64                 return getChildren(element).length > 0;
65         }
66
67         /*
68          * (non-Javadoc)
69          * 
70          * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
71          */
72         public Object[] getElements(Object inputElement) {
73
74                 return getChildren(inputElement);
75
76         }
77
78         /*
79          * (non-Javadoc)
80          * 
81          * @see org.eclipse.jface.viewers.IContentProvider#dispose()
82          */
83         public void dispose() {
84
85         }
86
87         /*
88          * (non-Javadoc)
89          * 
90          * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
91          *      java.lang.Object, java.lang.Object)
92          */
93         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
94                 // TODO Auto-generated method stub
95
96         }
97
98 }