Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » ITreeViewerListener.treeExpanded() not showing added child nodes
ITreeViewerListener.treeExpanded() not showing added child nodes [message #468176] Tue, 04 August 2009 13:10 Go to next message
Ben Dixon is currently offline Ben DixonFriend
Messages: 63
Registered: July 2009
Member
I've just added databinding to my application which consists primarily of
a TreeViewer the navigates my model. Originally child nodes were added to
nodes in the tree as those nodes were expanded. After I setup databinding
adding the children directly in treeExpanded(TreeExpansionEvent) no longer
works and I'm trying to figure out why. I inspected the results of calling
getChildren on my IContentProvider (implemented by
ObservableListTreeContentProvider) and the children are returned as
expected but once treeExpanded() returns, the tree is not updated except
that the little arrow next to the parent node disappears completely. No
children appear under it. Here's how I set up the databinding (pardon the
formatting):

Realm realm = SWTObservables.getRealm(viewer.getControl().getDisplay());
ObservableListTreeContentProvider contentProvider = new
ObservableListTreeContentProvider(childrenProp.listFactory(r ealm), new
TreeStructureAdvisorImpl());

viewer.setContentProvider(contentProvider);
viewer.setLabelProvider(new
ObservableMapLabelProvider(Properties.observeEach(contentPro vider.getKnownElements(),
labelProps)));

viewer.setInput(model);

And the treeExpanded() method:

public void treeExpanded(TreeExpansionEvent event) {
AbstractTreeViewer treeViewer = event.getTreeViewer();

Object element = event.getElement();
System.err.println(element + " was expanded");
if(element instanceof TypeA){
TypeA prop = (TypeA) element;
Data data = fetchData(prop); // fetch data adds child nodes to the
model, essentially children.add(datum) where children is a List.



}
}

Any help in determining why the child nodes don't appear in the tree
though they appear in the model and the property change fires, would be
very much appreciated.

Also, I'd like to thank Matthew for his help with my original databinding
problem.

Ben
Re: ITreeViewerListener.treeExpanded() not showing added child nodes [message #468266 is a reply to message #468176] Tue, 04 August 2009 18:31 Go to previous message
Ben Dixon is currently offline Ben DixonFriend
Messages: 63
Registered: July 2009
Member
I figured it out. I needed to make the call to TreeViewer.refresh()
asynchronously.
Previous Topic:Scrollbars In Views And Icons
Next Topic:UI latencies with many objects in navigatorContent
Goto Forum:
  


Current Time: Thu Apr 18 23:18:07 GMT 2024

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

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

Back to the top