01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.elements;
11:
12: import org.eclipse.jface.viewers.ITreeContentProvider;
13: import org.eclipse.jface.viewers.Viewer;
14:
15: public class TreeContentProvider extends ListContentProvider implements
16: ITreeContentProvider {
17:
18: public TreeContentProvider() {
19: super ();
20: }
21:
22: public void dispose() {
23: }
24:
25: public Object[] getChildren(Object element) {
26: if (element instanceof IPDEElement) {
27: return ((IPDEElement) element).getChildren();
28: }
29: return null;
30: }
31:
32: public Object[] getElements(Object element) {
33: if (element instanceof IPDEElement) {
34: return ((IPDEElement) element).getChildren();
35: }
36: return null;
37: }
38:
39: public Object getParent(Object element) {
40: if (element instanceof IPDEElement) {
41: return ((IPDEElement) element).getParent();
42: }
43: return null;
44: }
45:
46: public boolean hasChildren(java.lang.Object element) {
47: if (element instanceof IPDEElement) {
48: Object[] children = ((IPDEElement) element).getChildren();
49: return children != null && children.length > 0;
50: }
51: return false;
52: }
53:
54: public void inputChanged(Viewer viewer, Object oldInput,
55: Object newInput) {
56: }
57:
58: public boolean isDeleted(Object element) {
59: return false;
60: }
61: }
|