1 /*************************************************************************
2 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
4 * Plugin for PHP unit Testing.
7 *************************************************************************/
9 package net.sourceforge.phpeclipse.phpunit;
11 import java.util.Vector;
13 import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
14 import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
16 import org.eclipse.jface.viewers.ITreeContentProvider;
17 import org.eclipse.jface.viewers.Viewer;
19 public class TestPoolContentProvider implements ITreeContentProvider {
24 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
26 public Object[] getChildren(Object parentElement) {
28 if (parentElement instanceof TestSuite) {
30 Vector allChildren = new Vector();
31 allChildren.addAll(((TestSuite) parentElement).getTestCases());
32 allChildren.addAll(((TestSuite) parentElement).getTestSuites());
34 return allChildren.toArray();
45 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
47 public Object getParent(Object element) {
49 if (element instanceof TestSuite)
50 return ((TestSuite) element).getParent();
51 else if (element instanceof TestCase)
52 return ((TestCase) element).getParentSuite();
60 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
62 public boolean hasChildren(Object element) {
64 return getChildren(element).length > 0;
70 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
72 public Object[] getElements(Object inputElement) {
74 return getChildren(inputElement);
81 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
83 public void dispose() {
90 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
91 * java.lang.Object, java.lang.Object)
93 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
94 // TODO Auto-generated method stub