Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Decorators
Decorators [message #10690] Mon, 01 June 2009 14:20 Go to next message
Marco Maccaferri is currently offline Marco MaccaferriFriend
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 Go to previous messageGo to next message
Boris Bokowski is currently offline Boris BokowskiFriend
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.
Re: Decorators [message #11947 is a reply to message #11934] Thu, 04 June 2009 14:44 Go to previous message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 147
Registered: July 2009
Senior Member
On 04/06/2009 15:50 Boris Bokowski ha scritto:

> 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.

The problem doesn't seems the caching only. I discovered that the label
decorator also implements IDelayedLabelDecorator, unfortunately
prepareDecoration always returns true even if the decoration is not
ready (or so I think, my label decorator always returns true since it is
always ready....).

> If anybody else has had success with declarative background color
> decorations that don't blink, I'd like to hear how you did it.

The solution I found is to return a "known invalid" color so I know that
the color is from the decorator and can safely set the default
background. If the decorator returns null I know that it is not ready
yet and don't touch the current background.


Regards,
Marco.
Previous Topic:What are the alternative solutions for DecorationOverlayIcon when using org.ecli
Next Topic:On the fly highlighting in text editors
Goto Forum:
  


Current Time: Sun Dec 22 03:59:17 GMT 2024

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

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

Back to the top