[JFace Virtual Tree] Dynamically add children [message #334798] |
Fri, 27 February 2009 12:01  |
Eclipse User |
|
|
|
<Posted this query in eclipse.platform.swt a while back. Didn't get a
response, posting the query in this forum>
Hi All,
I need to dynamically add child nodes to the root node in a virtual tree.
When creating the tree, only the root nodes are known - the child nodes
are determined by invoking a remote server call. For the "plus" sign to
show up in the root node, I pass "1" as the currentChildCount in
updateElement method of ILazyTreeContentProvider. Just to be clear, below
is the code. If I don't set the currentChildCount, the plus sign doesn't
show up.
public void updateChildCount(Object element, int currentChildCount) {
treeViewer.setChildCount(element, currentChildCount);
}
public void updateElement(Object parent, int index) {
treeViewer.replace(parent, index, model[index]);
updateChildCount(model[index], 1);
}
I noticed that there was an earlier discussion in regard to this issue -
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg27927.html,
but it didn't provide a solution.
I added a tree listener to handle the tree expansion event, but that
doesn't work either.
Can somebody help?
Regards,
Ravi
|
|
|
Re: [JFace Virtual Tree] Dynamically add children [message #334857 is a reply to message #334798] |
Tue, 03 March 2009 12:57  |
Eclipse User |
|
|
|
Hello,
Can anyone please help me with the below?
Ravi
Ravi wrote:
> <Posted this query in eclipse.platform.swt a while back. Didn't get a
> response, posting the query in this forum>
> Hi All,
> I need to dynamically add child nodes to the root node in a virtual tree.
> When creating the tree, only the root nodes are known - the child nodes
> are determined by invoking a remote server call. For the "plus" sign to
> show up in the root node, I pass "1" as the currentChildCount in
> updateElement method of ILazyTreeContentProvider. Just to be clear, below
> is the code. If I don't set the currentChildCount, the plus sign doesn't
> show up.
> public void updateChildCount(Object element, int currentChildCount) {
> treeViewer.setChildCount(element, currentChildCount);
> }
> public void updateElement(Object parent, int index) {
> treeViewer.replace(parent, index, model[index]);
> updateChildCount(model[index], 1);
> }
> I noticed that there was an earlier discussion in regard to this issue -
> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg27927.html,
> but it didn't provide a solution.
> I added a tree listener to handle the tree expansion event, but that
> doesn't work either.
> Can somebody help?
> Regards,
> Ravi
|
|
|
Powered by
FUDForum. Page generated in 0.03563 seconds