Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How To: Delete SWT Tree nodes dynamically
How To: Delete SWT Tree nodes dynamically [message #448419] Sun, 09 January 2005 15:35 Go to next message
Eclipse UserFriend
Originally posted by: david.REMOVE.REMOVE.m5inc.com

I'm using Tree object in my SWT application.

I dynamically insert TreeItem objects as my application generates them
(work fine).

I need to also be able to delete nodes (TreeItem) dynamically.

I don't see anything in the Tree or a TreeItem that allows me to delete
a node.

The best that I can find is Tree's 'removeAll()' method which implies
that to delete a node I have to:
- get all the existing nodes into a collection,
- remove all the nodes from the Tree,
- remove the selected node from the collection,
- re-insert all the nodes back into the Tree.

This is a draconian solution which doesn't scale up properly when there
are many nodes in the Tree.

-TIA
David
Re: How To: Delete SWT Tree nodes dynamically [message #448422 is a reply to message #448419] Mon, 10 January 2005 00:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: skrap.post.gmail.com

You can use TreeItem.dispose() to get rid of individual nodes.

/Johan

David J. Marcus wrote:

> I need to also be able to delete nodes (TreeItem) dynamically.

> I don't see anything in the Tree or a TreeItem that allows me to delete
> a node.
Re: How To: Delete SWT Tree nodes dynamically [message #448491 is a reply to message #448422] Tue, 11 January 2005 08:55 Go to previous message
Eclipse UserFriend
Originally posted by: david.REMOVE.REMOVE.m5inc.com

It worked... thanks.

Its such a 'well documented' side effect of 'dispose' that I would never
have found it! ;-)

-David

Johan Karlsson wrote:
> You can use TreeItem.dispose() to get rid of individual nodes.
>
> /Johan
>
> David J. Marcus wrote:
>
>> I need to also be able to delete nodes (TreeItem) dynamically.
>
>
>> I don't see anything in the Tree or a TreeItem that allows me to
>> delete a node.
>
>
>
Previous Topic:PDF Viewer plugin AWT/SWT problem
Next Topic:click on the label
Goto Forum:
  


Current Time: Sun Jul 06 12:13:09 EDT 2025

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

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

Back to the top