Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » TreeViewer Memory Mgt.(Need to unload children when node is collapsed)
TreeViewer Memory Mgt. [message #536190] Thu, 27 May 2010 10:57 Go to next message
lemonjelly  is currently offline lemonjelly Friend
Messages: 2
Registered: May 2010
Junior Member
Hi folks,

I have Googled for this info and I can't seem to find an answer, I would assume it is a pretty straight forward request.

As I may be dealing with a tree of up to 35000 nodes. I would like to exercise some control over the nodes that are loaded into memory.

I notice that the OOTB implementation of the TreeViewer loads nodes in a lazy manner i.e. when a parent is expanded. I would like to be able to reset a node to that state when the node is collapsed (i.e. remove the children from the memory)

Any advice pointers would be really helpful.

Cheers!
Re: TreeViewer Memory Mgt. [message #536206 is a reply to message #536190] Thu, 27 May 2010 11:25 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 27/05/10 4:27 PM, lemonjelly wrote:
> I notice that the OOTB implementation of the TreeViewer loads nodes in a
> lazy manner i.e. when a parent is expanded. I would like to be able to
> reset a node to that state when the node is collapsed (i.e. remove the
> children from the memory)
> Any advice pointers would be really helpful.

Have a look at TreeViewer.handleTreeCollapse() and
ITreeViewerListener.treeCollapsed()


--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: TreeViewer Memory Mgt. [message #536239 is a reply to message #536206] Thu, 27 May 2010 13:14 Go to previous message
lemonjelly  is currently offline lemonjelly Friend
Messages: 2
Registered: May 2010
Junior Member
Prakash,

Thank you for the quick reply. I guess those methods will help me respond to the event associated with collapsing the tree. Or perhaps I am missing the point.

If I am not missing the point I am able to do that with the following
TreeViewer.getTree().addTreeListener(new CollapseExpandListener(viewer));

Where CollapseExpandListener is a UDT where I attempt to unload the nodes.

So the point where I am stuck is instructing the TreeViewer to remove the child nodes that were loaded (and cached) when the node was expanded. See code below.

 
class CollapseExpandListener implements TreeListener{
                     TreeViewer sourceTreeViewer;
	CollapseExpandListener(TreeViewer tree){
		sourceTreeViewer = tree;
	}
	@Override
	public void treeCollapsed(TreeEvent e) {
                              ISecTreeNode node = ((ISecTreeNode)e.item.getData())
	
HOW DIO I REMOVE THE CAHCNED CHILDREN from node????
	}
	@Override
	public void treeExpanded(TreeEvent e) {
                               //NO-OP
                     }
}
Previous Topic:[Mac]How to enable Mac Help(Accelerate Key: Command+Shift+?) in RCP based application
Next Topic:Feature Export in 3.5 not creating feature jnlp file
Goto Forum:
  


Current Time: Fri Apr 26 06:19:05 GMT 2024

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

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

Back to the top