KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit > ui > TestSessionTreeContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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 JavaDoc[] NO_CHILDREN= new Object JavaDoc[0];
25     
26     public void dispose() {
27     }
28
29     public Object JavaDoc[] getChildren(Object JavaDoc parentElement) {
30         if (parentElement instanceof TestSuiteElement)
31             return ((TestSuiteElement) parentElement).getChildren();
32         else
33             return NO_CHILDREN;
34     }
35
36     public Object JavaDoc[] getElements(Object JavaDoc inputElement) {
37         return ((TestRoot) inputElement).getChildren();
38     }
39
40     public Object JavaDoc getParent(Object JavaDoc element) {
41         return ((TestElement) element).getParent();
42     }
43
44     public boolean hasChildren(Object JavaDoc 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 JavaDoc oldInput, Object JavaDoc newInput) {
52     }
53 }
54
Popular Tags