Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [JFace Virtual Tree] Dynamically add children
[JFace Virtual Tree] Dynamically add children [message #334798] Fri, 27 February 2009 12:01 Go to next message
Eclipse UserFriend
<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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Switch perspective open Welcome page
Next Topic:react on editor action "new Editor"
Goto Forum:
  


Current Time: Sun May 04 15:57:38 EDT 2025

Powered by FUDForum. Page generated in 0.03563 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top