|Re: TableViewer setInput() questions [message #718443 is a reply to message #668499]
||Wed, 24 August 2011 10:54
Originally posted by: |
On 2011-05-05 23:09, Catalin Gerea wrote:
> I have a question related to a table viewer that is updated frequently
> (3-6 times per minute). This update is performed every time by calling
You should use setInput() only, if your input has changed, otherwise you
should better use the refresh() function.
> 1. Is this the correct way to update the table viewer?
I don't know, because you don't say whether your input really has
changed or whether the data within your input has changed. In the latter
case, refresh() is more appropriate, but I don't think that both have
very different performance characteristics. If only a subset of all
elements of the viewer have changed, you should user the refresh
overload that accept an array of objects. If not the structure has
changed, but only aspects that influence the label or icon of the
element, you should use the update() functions.
> As far I could saw from code: the setInput() from StructuredViewer get's
> called -> unmapAllElements() -> elementMap =
> newHashtable(CustomHashtable.DEFAULT_CAPACITY); -> return new
> CustomHashtable(capacity, getComparer());.
> This means that every call to setInput() will trigger the creation of a
> new CustomHashtable; in my case 8640 new objects per day.
> 2. How are these new objects destroyed, because I did not saw any code
> that empties the elementMap?
You should not need to care about this: It is an implementation detail
of the viewer. If you are really observing that this has significant
performance disadvantages, you should open a bug report (But you should
first publish what exactly your test situation was).
HTH & Greetings from Bremen,
- Daniel Krügler
Powered by FUDForum
. Page generated in 0.10989 seconds