Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Indention when using images in TreeViewer
Indention when using images in TreeViewer [message #334481] Thu, 12 February 2009 05:48 Go to next message
Ricky Patel is currently offline Ricky PatelFriend
Messages: 33
Registered: July 2009
Member
I have a TreeViewer of which the children elements will have images but
the parent elements will not (they receive null as an image). I've noticed
that when the children elements are not shown, the tree looks like the
following:

> Parent1
> Parent2

But then when I expand the tree the parent item is given space for an icon
though it does not have one so the tree looks like this:

> Parent 1
(icon) Child 1
(icon) Child 2
> Parent 2
(icon) Child 1
(icon) Child 2

Is there anyway to not have this extra indention of space? Is this a flaw
in ILabelProvider or is it how ILabelProvider is supposed to react? I
assumed that the following would have happened instead...

> Parent 1
(icon) Child 1
(icon) Child 2
> Parent 2
(icon) Child 1
(icon) Child 2
Re: Indention when using images in TreeViewer [message #334482 is a reply to message #334481] Thu, 12 February 2009 06:00 Go to previous message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
This is the standard operating system behavior. If you want to go to
the trouble, you could override it using owner draw:

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/jface/viewers/Own erDrawLabelProvider.html

Matthew

Ricky Patel wrote:
> I have a TreeViewer of which the children elements will have images but
> the parent elements will not (they receive null as an image). I've
> noticed that when the children elements are not shown, the tree looks
> like the following:
>
>> Parent1
>> Parent2
>
> But then when I expand the tree the parent item is given space for an
> icon though it does not have one so the tree looks like this:
>
>> Parent 1
> (icon) Child 1
> (icon) Child 2
>> Parent 2
> (icon) Child 1
> (icon) Child 2
>
> Is there anyway to not have this extra indention of space? Is this a
> flaw in ILabelProvider or is it how ILabelProvider is supposed to react?
> I assumed that the following would have happened instead...
>
>> Parent 1
> (icon) Child 1
> (icon) Child 2
>> Parent 2
> (icon) Child 1
> (icon) Child 2
>
Previous Topic:Common Navigator showing expanded folders
Next Topic:Search Plugin
Goto Forum:
  


Current Time: Fri Apr 26 20:33:35 GMT 2024

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

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

Back to the top