1 11 12 package org.eclipse.jdt.internal.junit.ui; 13 14 import org.eclipse.jface.viewers.ITreeContentProvider; 15 import org.eclipse.jface.viewers.Viewer; 16 17 import org.eclipse.jdt.internal.junit.model.TestElement; 18 import org.eclipse.jdt.internal.junit.model.TestRoot; 19 import org.eclipse.jdt.internal.junit.model.TestSuiteElement; 20 21 22 public class TestSessionTreeContentProvider implements ITreeContentProvider { 23 24 private final Object [] NO_CHILDREN= new Object [0]; 25 26 public void dispose() { 27 } 28 29 public Object [] getChildren(Object parentElement) { 30 if (parentElement instanceof TestSuiteElement) 31 return ((TestSuiteElement) parentElement).getChildren(); 32 else 33 return NO_CHILDREN; 34 } 35 36 public Object [] getElements(Object inputElement) { 37 return ((TestRoot) inputElement).getChildren(); 38 } 39 40 public Object getParent(Object element) { 41 return ((TestElement) element).getParent(); 42 } 43 44 public boolean hasChildren(Object element) { 45 if (element instanceof TestSuiteElement) 46 return ((TestSuiteElement) element).getChildren().length != 0; 47 else 48 return false; 49 } 50 51 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { 52 } 53 } 54 | Popular Tags |