[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Problem inserting an element into a TableViewer with a filter

Nick, great to hear that you have filed a PR about this problem.

Your work-around is fine and it works.  However, for people using MOF2,
another work-around is necessary because the insert and update calls are
generate automatically and the developer does not have easy control over
them.  I am working around this problem in another way, and I want to
share it here with other people.

The work-around is to add a sorter which sorts the elements in the model
order.  Since a sorter is available, the indexOfElement method actually
returns a meaningful result and enables the element to be inserted
correctly.

Using a sorter sounds like a bad performance choice.  However, I don't
think that a full sort was performed during the insert.  The method
indexOfElement just uses the sorter to perform a binary search of the
proper index to search for the element, which is an O(log(N)) operation.

The statements above are the results of very casual thoughts and may be
incorrect.  I am sharing this as a possible alternative.  If something is
wrong please correct me.

Hope this helps.