Decorators [message #10690] |
Mon, 01 June 2009 14:20 |
Marco Maccaferri Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Hi.
I need some help to get decorators working properly.
I want to add a background color decorator to a table viewer. The
decorator is declared as a lightweight decorator using the
org.eclipse.ui.decorators extension. The decorate method sets the
background color, if needed.
The basics are working, the problem is that whenever the decorated row
is updated, the background blinks: it changes to the default color and
then after a short time it is redrawn with the decorated color. Since
that row could be updated several times the effect is very annoying.
Debugging the label provider and decorator, I found that the
decorateBackground method doesn't always return the color, just after an
update it returns null, then it returns the color. This will cause the
blinking because when the decorator returns null the viewer label
provider sets a default color. I've set the decorator so it always
returns the color, just to be sure that it wasn't an error within the
decorator checks.
Seems that the decorator manager thinks that the decoration needs to be
recomputed, but who tells it to do so ? The decorator should be updated
only when an event occurs and I'm fairly sure that this even doesn't
happen (I've disabled the code that triggers an update).
Regards,
Marco.
|
|
|
Re: Decorators [message #11934 is a reply to message #10690] |
Thu, 04 June 2009 13:50 |
Boris Bokowski Messages: 272 Registered: July 2009 |
Senior Member |
|
|
Hi Marco,
You may be out of luck - DecoratingLabelProvider has code that keeps the old
text and image even though the decoration is not yet ready, to get around
the problem of blinking. I haven't seen the equivalent code for foreground
and background color.
If anybody else has had success with declarative background color
decorations that don't blink, I'd like to hear how you did it.
Boris
"Marco Maccaferri" <macca@maccasoft.com> wrote in message
news:h00o3n$h5n$1@build.eclipse.org...
> Hi.
>
> I need some help to get decorators working properly.
>
> I want to add a background color decorator to a table viewer. The
> decorator is declared as a lightweight decorator using the
> org.eclipse.ui.decorators extension. The decorate method sets the
> background color, if needed.
>
> The basics are working, the problem is that whenever the decorated row is
> updated, the background blinks: it changes to the default color and then
> after a short time it is redrawn with the decorated color. Since that row
> could be updated several times the effect is very annoying.
>
> Debugging the label provider and decorator, I found that the
> decorateBackground method doesn't always return the color, just after an
> update it returns null, then it returns the color. This will cause the
> blinking because when the decorator returns null the viewer label provider
> sets a default color. I've set the decorator so it always returns the
> color, just to be sure that it wasn't an error within the decorator
> checks.
>
> Seems that the decorator manager thinks that the decoration needs to be
> recomputed, but who tells it to do so ? The decorator should be updated
> only when an event occurs and I'm fairly sure that this even doesn't
> happen (I've disabled the code that triggers an update).
>
> Regards,
> Marco.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02919 seconds