01: /*******************************************************************************
02: * Copyright (c) 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 viewers that
14: * provides content based on the path of elements in the tree viewer..
15: *
16: * @see AbstractTreeViewer
17: * @since 3.2
18: */
19: public interface ITreePathContentProvider extends
20: IStructuredContentProvider {
21:
22: /**
23: * Returns the child elements of the last element in the given path.
24: * Implementors may want to use the additional context of the complete path
25: * of a parent element in order to decide which children to return.
26: * <p>
27: * The provided path is relative to the input. The root elements must
28: * be obtained by calling
29: * {@link IStructuredContentProvider#getElements(Object)}.
30: * </p>
31: * The result is not modified by the viewer.
32: *
33: * @param parentPath
34: * the path of the parent element
35: * @return an array of child elements
36: */
37: public Object[] getChildren(TreePath parentPath);
38:
39: /**
40: * Returns whether the last element of the given path has children.
41: * <p>
42: * Intended as an optimization for when the viewer does not need the actual
43: * children. Clients may be able to implement this more efficiently than
44: * <code>getChildren</code>.
45: * </p>
46: *
47: * @param path
48: * the path
49: * @return <code>true</code> if the lat element of the path has children,
50: * and <code>false</code> if it has no children
51: */
52: public boolean hasChildren(TreePath path);
53:
54: /**
55: * Return the possible parent paths for the given element. An empty array
56: * can be returned if the paths cannot be computed. If the element is
57: * a potential child of the input of the viewer, an empty tree path
58: * should be an entry in the returned array.
59: *
60: * @param element
61: * the element
62: * @return the possible parent paths for the given element
63: */
64: public TreePath[] getParents(Object element);
65: }
|