1 11 12 package org.eclipse.jdt.internal.junit.ui; 13 14 import java.util.ArrayList ; 15 16 import org.eclipse.jface.viewers.IStructuredContentProvider; 17 import org.eclipse.jface.viewers.Viewer; 18 19 import org.eclipse.jdt.junit.model.ITestElement; 20 21 import org.eclipse.jdt.internal.junit.model.TestCaseElement; 22 import org.eclipse.jdt.internal.junit.model.TestRoot; 23 import org.eclipse.jdt.internal.junit.model.TestSuiteElement; 24 25 26 public class TestSessionTableContentProvider implements IStructuredContentProvider { 27 28 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 29 } 30 31 public Object [] getElements(Object inputElement) { 32 ArrayList all= new ArrayList (); 33 addAll(all, (TestRoot) inputElement); 34 return all.toArray(); 35 } 36 37 private void addAll(ArrayList all, TestSuiteElement suite) { 38 ITestElement[] children= suite.getChildren(); 39 for (int i= 0; i < children.length; i++) { 40 ITestElement element= children[i]; 41 if (element instanceof TestSuiteElement) { 42 if (((TestSuiteElement) element).getSuiteStatus().isErrorOrFailure()) 43 all.add(element); addAll(all, (TestSuiteElement) element); 45 } else if (element instanceof TestCaseElement) { 46 all.add(element); 47 } 48 } 49 } 50 51 public void dispose() { 52 } 53 } 54 | Popular Tags |