1 /*************************************************************************
2 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
4 * Plugin for PHP unit Testing.
7 *************************************************************************/
10 package net.sourceforge.phpeclipse.phpunit;
12 import java.util.Vector;
14 import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
15 import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
17 import org.eclipse.jface.viewers.ITreeContentProvider;
18 import org.eclipse.jface.viewers.Viewer;
22 public class TestPoolContentProvider implements ITreeContentProvider {
27 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
29 public Object[] getChildren(Object parentElement) {
31 if(parentElement instanceof TestSuite) {
33 Vector allChildren = new Vector();
34 allChildren.addAll(((TestSuite)parentElement).getTestCases());
35 allChildren.addAll(((TestSuite)parentElement).getTestSuites());
37 return allChildren.toArray();
47 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
49 public Object getParent(Object element) {
51 if(element instanceof TestSuite)
52 return ((TestSuite)element).getParent();
53 else if (element instanceof TestCase)
54 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;
68 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
70 public Object[] getElements(Object inputElement) {
72 return getChildren(inputElement);
77 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
79 public void dispose() {
84 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
86 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
87 // TODO Auto-generated method stub