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.*;
16 import org.eclipse.jface.viewers.ITreeContentProvider;
17 import org.eclipse.jface.viewers.Viewer;
21 public class TestPoolContentProvider implements ITreeContentProvider {
26 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
28 public Object[] getChildren(Object parentElement) {
30 if(parentElement instanceof TestSuite) {
32 Vector allChildren = new Vector();
33 allChildren.addAll(((TestSuite)parentElement).getTestCases());
34 allChildren.addAll(((TestSuite)parentElement).getTestSuites());
36 return allChildren.toArray();
46 * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
48 public Object getParent(Object element) {
50 if(element instanceof TestSuite)
51 return ((TestSuite)element).getParent();
52 else if (element instanceof TestCase)
53 return ((TestCase)element).getParentSuite();
59 * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
61 public boolean hasChildren(Object element) {
63 return getChildren(element).length > 0;
67 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
69 public Object[] getElements(Object inputElement) {
71 return getChildren(inputElement);
76 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
78 public void dispose() {
83 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
85 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
86 // TODO Auto-generated method stub