[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: [jface.viewers] May CellLabelProvider.update be called by clients?

Hi,

Would you mind sharing the code (I suppose it's building ontop of your
snippet) then I'll take a look. I'm currently deep into Webservice
project (that's why I didn't had access to the source code) but I'll
give it a spin on the evening.

Tom

Daniel Krügler schrieb:
> Tom Schindl wrote:
>> I would expect that a redraw leads to callbacks into the ownerdraw
>> listeners who call back to the update()-method.
> 
> Hmmh, I can only partially confirm that. What I did is that I replaced
> my current call of
> 
> update(activeCell);
> 
> - where activeCell is the ViewerCell result from the previous
> getViewer().getCell(pt) call and update is the member method of my
> StyledCellLabelProvider derivative - by
> 
> Rectangle rect = activeCell.getBounds();
> activeCell.getControl().redraw(rect.x, rect.y, rect.width,
>     rect.height, true);
> 
> which is essentially the same call as FocusCellOwnerDrawHighlighter
> does. I see that a short time later the triade SWT.MeasureItem,
> SWT.EraseItem, and SWT.PaintItem of the OwnerDrawLabelProvider base
> class listener are invoked properly delegating to the corresponding
> StyledCellLabelProvider callbacks, but none of them seems calls the
> update method of my StyledCellLabelProvider derivative. There is no
> direct observable change (i.e. no color change) in contrast to my
> previous code.
> 
> Can this be correct? Let me note that OwnerDrawLabelProvider#update
> itself calls
> 
> // Force a redraw
> Rectangle cellBounds = cell.getBounds();
> cell.getControl().redraw(cellBounds.x, cellBounds.y, cellBounds.width,
>         cellBounds.height, true);
> 
> but if this would call update again, this would cause an infinitive
> recursion. Currently I see no alternative to a direct call to my
> StyledCellLabelProvider#update method, but I would be glad if someone
> points to the obvious glitch in my code.
> 
> Thanks,
> 
> Daniel