Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Customizing TreeItem ?
Customizing TreeItem ? [message #460706] Sun, 04 September 2005 21:26 Go to next message
David is currently offline DavidFriend
Messages: 47
Registered: July 2009
Member
Hi,

I'm a newbie in SWT but I've seen that TreeItem is not supposed to be
customized. So what should I do if I would like to have an object which
has the same properties as TreeItem plus some little things I'd like to
add for my personal use?

Are there any solutions or are we limited to use TreeItem ? (Can we put
other things then a TreeItem in a Tree ?)

Thanx for the help,
David
Re: Customizing TreeItem ? [message #460708 is a reply to message #460706] Sun, 04 September 2005 22:43 Go to previous messageGo to next message
James Leotta is currently offline James LeottaFriend
Messages: 202
Registered: July 2009
Senior Member
David wrote:
> Hi,
>
> I'm a newbie in SWT but I've seen that TreeItem is not supposed to be
> customized. So what should I do if I would like to have an object which
> has the same properties as TreeItem plus some little things I'd like to
> add for my personal use?
>
> Are there any solutions or are we limited to use TreeItem ? (Can we put
> other things then a TreeItem in a Tree ?)

Use jface.TreeViewer There are many examples. Do a search on web for
TreeViewer examples. You can put anything into the tree you want but you
need to create a ContentProvider and a LabelProvider. If they are
different objects create an Interface like ITreeable and make all your
objects implement it.
>
> Thanx for the help,
> David
>
Re: Customizing TreeItem ? [message #460714 is a reply to message #460706] Mon, 05 September 2005 03:59 Go to previous messageGo to next message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
David wrote:
> I'm a newbie in SWT but I've seen that TreeItem is not supposed to be
> customized. So what should I do if I would like to have an object which
> has the same properties as TreeItem plus some little things I'd like to
> add for my personal use?
>
> Are there any solutions or are we limited to use TreeItem ? (Can we put
> other things then a TreeItem in a Tree ?)

You can associate data with a TreeItem using item.setData().

-Billy
Re: Customizing TreeItem ? [message #460722 is a reply to message #460706] Mon, 05 September 2005 13:55 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
Have a look at http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArti cle.htm if you're interested in doing complex things in trees.

The SWT component is a low-level device, whereas the TreeViewer is a higher-level component that does a lot more of the wiring work for you. The only downside with TreeViewer is that you'll need to view it as a View inside Eclipse, which if you're developing a standalone SWT application might not be what you want.

On the other hand, now might be a good time to look at the Rich Client Platform instead of roll-your-own SWT apps :-)
Re: Customizing TreeItem ? [message #460723 is a reply to message #460722] Mon, 05 September 2005 14:01 Go to previous messageGo to next message
Neil Bartlett is currently offline Neil BartlettFriend
Messages: 93
Registered: July 2009
Member
> The only downside with TreeViewer is that you'll need to view it as a View
> inside Eclipse

No you don't.
Re: Customizing TreeItem ? [message #460724 is a reply to message #460723] Mon, 05 September 2005 16:18 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
Sorry, I should have said 'without using the JFace plugins as well'. There's always the possibilty that the questioner is writing a standalone SWT app without using any of the Eclipse plugin mechanism.
Re: Customizing TreeItem ? [message #460726 is a reply to message #460724] Mon, 05 September 2005 16:34 Go to previous message
Neil Bartlett is currently offline Neil BartlettFriend
Messages: 93
Registered: July 2009
Member
You don't have to use the JFace plugins either, you can use the JFace jar
directly in a standalone application. If you've got JFace on your
classpath you can use TreeViewer anywhere that you can use Tree.


Alex Blewitt wrote:

> Sorry, I should have said 'without using the JFace plugins as well'. There's
always the possibilty that the questioner is writing a standalone SWT app
without using any of the Eclipse plugin mechanism.
Previous Topic:2 trees in sync with one scrollbar
Next Topic:InvocationTargetException
Goto Forum:
  


Current Time: Fri Mar 29 13:08:11 GMT 2024

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

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

Back to the top