| Summary: | [Decorators] Lightweight decorator does not work properly when objectState is changed too fast | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Serge Yuschenko <Serge_Yuschenko> |
| Component: | Doc | Assignee: | Tod Creasey <Tod_Creasey> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | andrea_covas, eclipse, michaelvanmeekeren, ryanman |
| Version: | 3.0 | Keywords: | helpwanted |
| Target Milestone: | 3.1 M3 | ||
| Hardware: | PC | ||
| OS: | Windows 98 | ||
| Whiteboard: | |||
|
Description
Serge Yuschenko
This would need some new API to invalidate current results - if a change in state occurs before update does this could result in a stale decorations. Thinking more about this I am not sure that we can safely do this and get the timing right as this would add a potential thrid point of entry into the cache (one to schedule, a clear on an update and then this one). If you know you have requested an update and it has not come back then you know it is invalid - what you may want to do is repost the label update after you get it. I'll leave this open as there may be a better way but I don't have a safe solution to this issue. What do you mean by "has not come back"? As far as I understand the whole idea of decoration is to do the job asynchronously to a thread calling update(). The TreeViewer.update( element, null ) comes back right away while decoration job is still in progress. What I'm missing? About the problem... What if instead of invalidating an outdated decoration we leave it there and add a new one if decoration definitions are different. In this case proper decoration will be shown sooner or later. The obvious drawback of this approach is that a decoration definition queue for each cached object has to be added. Just an idea... I mean that the request has occured but you have not got the label update notification yet (i.e. decorations are still being calculated). The main concern I have is performance. If someone continuously has to invalidate possible cached results it is possible to end up with a lot of extra computation going on. This can get really bad on something like a Resource Navigator. The decorators now are updated as a result of resource deltas in most viewers - I assume your update does not. Your could also fire an update when your state change occurs using a job that blocks on a scheduling rule using DecoratorManager.FAMILY_DECORATE. I understand this is not API currently but I am not adverse to promoting it if that can solve this issue. Thanks for the advice. Now I understand what you're saying. That's right, I have to take a synchronous approach. I think in my case instead of synchronizing with a decorating thread it would be even better (less tangle) just to implement a ILabelDecorator on my own. I didn't do this at the beginning mostly because of ubiquitous encouragement to use lightweight decorator wherever it is possible, and secondly because I tried to avoid dealing with images. Maybe it would be helpful to add a caveat about lightweight decorator timing issue in documentation. Thats a fine idea Serge - we should add a section on this to the ISV doc. *** Bug 68600 has been marked as a duplicate of this bug. *** Doc has been released to /org.eclipse.platform.doc.isv/guide/workbench_advext_decorators.htm for build >20041029 Marking as closed. |