KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > ITreePathContentProvider


1 /*******************************************************************************
2  * Copyright (c) 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.jface.viewers;
13
14 /**
15  * An interface to content providers for tree-structure-oriented viewers that
16  * provides content based on the path of elements in the tree viewer..
17  *
18  * @see AbstractTreeViewer
19  * @since 3.2
20  */

21 public interface ITreePathContentProvider extends IStructuredContentProvider {
22
23     /**
24      * Returns the child elements of the last element in the given path.
25      * Implementors may want to use the additional context of the complete path
26      * of a parent element in order to decide which children to return.
27      * <p>
28      * The provided path is relative to the input. The root elements must
29      * be obtained by calling
30      * {@link IStructuredContentProvider#getElements(Object)}.
31      * </p>
32      * The result is not modified by the viewer.
33      *
34      * @param parentPath
35      * the path of the parent element
36      * @return an array of child elements
37      */

38     public Object JavaDoc[] getChildren(TreePath parentPath);
39
40     /**
41      * Returns whether the last element of the given path has children.
42      * <p>
43      * Intended as an optimization for when the viewer does not need the actual
44      * children. Clients may be able to implement this more efficiently than
45      * <code>getChildren</code>.
46      * </p>
47      *
48      * @param path
49      * the path
50      * @return <code>true</code> if the lat element of the path has children,
51      * and <code>false</code> if it has no children
52      */

53     public boolean hasChildren(TreePath path);
54
55     /**
56      * Return the possible parent paths for the given element. An empty array
57      * can be returned if the paths cannot be computed. If the element is
58      * a potential child of the input of the viewer, an empty tree path
59      * should be an entry in the returned array.
60      *
61      * @param element
62      * the element
63      * @return the possible parent paths for the given element
64      */

65     public TreePath[] getParents(Object JavaDoc element);
66 }
67
Popular Tags