comparison dwtx/jface/viewers/ITreeContentProvider.d @ 10:b6c35faf97c8

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