comparison org.eclipse.jface/src/org/eclipse/jface/viewers/ILazyTreeContentProvider.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2005, 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 org.eclipse.jface.viewers.ILazyTreeContentProvider;
14
15 import org.eclipse.jface.viewers.IContentProvider;
16
17 import java.lang.all;
18 import java.util.Set;
19
20 /**
21 * The ILazyTreeContentProvider is the content provider for tree viewers created
22 * using the SWT.VIRTUAL flag that only wish to return their contents as they
23 * are queried.
24 *
25 * @since 3.2
26 */
27 public interface ILazyTreeContentProvider : IContentProvider {
28 /**
29 * Called when a previously-blank item becomes visible in the TreeViewer. If
30 * the content provider knows the child element for the given parent at this
31 * index, it should respond by calling
32 * {@link TreeViewer#replace(Object, int, Object)}. The content provider
33 * should also update the child count for any replaced element by calling
34 * {@link TreeViewer#setChildCount(Object, int)}. If the given current child
35 * count is already correct, setChildCount does not have to be called since
36 * a call to replace will not change the child count.
37 *
38 * <strong>NOTE</strong> #updateElement(int index) can be used to determine
39 * selection values. If TableViewer#replace(Object, int) is not called
40 * before returning from this method, selections may have missing or stale
41 * elements. In this situation it is suggested that the selection is asked
42 * for again after replace() has been called.
43 *
44 * @param parent
45 * The parent of the element, or the viewer's input if the
46 * element to update is a root element
47 * @param index
48 * The index of the element to update in the tree
49 */
50 public void updateElement(Object parent, int index);
51
52 /**
53 * Called when the TreeViewer needs an up-to-date child count for the given
54 * element, for example from {@link TreeViewer#refresh()} and
55 * {@link TreeViewer#setInput(Object)}. If the content provider knows the
56 * given element, it should respond by calling
57 * {@link TreeViewer#setChildCount(Object, int)}. If the given current
58 * child count is already correct, no action has to be taken by this content
59 * provider.
60 *
61 * @param element
62 * The element for which an up-to-date child count is needed, or
63 * the viewer's input if the number of root elements is requested
64 * @param currentChildCount
65 * The current child count for the element that needs updating
66 */
67 public void updateChildCount(Object element, int currentChildCount);
68
69 /**
70 * Returns the parent for the given element, or <code>null</code>
71 * indicating that the parent can't be computed.
72 * In this case the tree-structured viewer can't expand
73 * a given node correctly if requested.
74 *
75 * @param element the element
76 * @return the parent element, or <code>null</code> if it
77 * has none or if the parent cannot be computed
78 */
79 public Object getParent(Object element);
80 }