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.jface.viewers;
11:
12: /**
13: * An interface to content providers for tree-structure-oriented
14: * viewers.
15: *
16: * @see AbstractTreeViewer
17: */
18: public interface ITreeContentProvider extends
19: IStructuredContentProvider {
20: /**
21: * Returns the child elements of the given parent element.
22: * <p>
23: * The difference between this method and <code>IStructuredContentProvider.getElements</code>
24: * is that <code>getElements</code> is called to obtain the
25: * tree viewer's root elements, whereas <code>getChildren</code> is used
26: * to obtain the children of a given parent element in the tree (including a root).
27: * </p>
28: * The result is not modified by the viewer.
29: *
30: * @param parentElement the parent element
31: * @return an array of child elements
32: */
33: public Object[] getChildren(Object parentElement);
34:
35: /**
36: * Returns the parent for the given element, or <code>null</code>
37: * indicating that the parent can't be computed.
38: * In this case the tree-structured viewer can't expand
39: * a given node correctly if requested.
40: *
41: * @param element the element
42: * @return the parent element, or <code>null</code> if it
43: * has none or if the parent cannot be computed
44: */
45: public Object getParent(Object element);
46:
47: /**
48: * Returns whether the given element has children.
49: * <p>
50: * Intended as an optimization for when the viewer does not
51: * need the actual children. Clients may be able to implement
52: * this more efficiently than <code>getChildren</code>.
53: * </p>
54: *
55: * @param element the element
56: * @return <code>true</code> if the given element has children,
57: * and <code>false</code> if it has no children
58: */
59: public boolean hasChildren(Object element);
60: }
|