2 * Created on Aug 8, 2004
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
7 package net.sourceforge.phpeclipse.phpunit;
9 import java.util.Vector;
11 import net.sourceforge.phpeclipse.phpunit.testpool.*;
13 import org.eclipse.jface.viewers.ITreeContentProvider;
14 import org.eclipse.jface.viewers.Viewer;
17 * @author Ali Echihabi
19 * To change the template for this generated type comment go to
20 * Window>Preferences>Java>Code Generation>Code and Comments
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