KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > elements > TreeContentProvider


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 package org.eclipse.pde.internal.ui.elements;
12
13 import org.eclipse.jface.viewers.ITreeContentProvider;
14 import org.eclipse.jface.viewers.Viewer;
15
16 public class TreeContentProvider extends ListContentProvider implements ITreeContentProvider {
17
18 public TreeContentProvider() {
19     super();
20 }
21 public void dispose() {}
22 public Object JavaDoc[] getChildren(Object JavaDoc element) {
23     if (element instanceof IPDEElement) {
24         return ((IPDEElement)element).getChildren();
25     }
26     return null;
27 }
28 public Object JavaDoc[] getElements(Object JavaDoc element) {
29     if (element instanceof IPDEElement) {
30         return ((IPDEElement)element).getChildren();
31     }
32     return null;
33 }
34 public Object JavaDoc getParent(Object JavaDoc element) {
35     if (element instanceof IPDEElement) {
36         return ((IPDEElement)element).getParent();
37     }
38     return null;
39 }
40 public boolean hasChildren(java.lang.Object JavaDoc element) {
41     if (element instanceof IPDEElement) {
42         Object JavaDoc [] children = ((IPDEElement)element).getChildren();
43         return children != null && children.length > 0;
44     }
45     return false;
46 }
47 public void inputChanged(Viewer viewer, Object JavaDoc oldInput, Object JavaDoc newInput) {
48 }
49 public boolean isDeleted(Object JavaDoc element) {
50     return false;
51 }
52 }
53
Popular Tags