[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: question re. TableTree-viewer's refresh behavior

Hi,

first of all TableTreeViewer should have been deprecated in 3.2 and you should better use a TreeViewer instead.

If you only want to refresh a specific part of your tree then you could use refresh(Object,boolean) and not the whole tree gets refershed on the other hand TreeViewer tries to preserve the selection which doesn't work for you it seems.

I guess you are recreating *all* model elements from scratch everytime your content-providers getElements-method is called. If that's the case TreeViewer/TableTreeViewer is not able to preservet the selection and you need this your own. To see how this is done I'd suggest you read the JFace code yourself.

The methods of interest are:

- StructuredViewer#preservingSelection
- AbstractTreeViewer#setSelectionToWidget

Another resource might be a snippet I uploaed recently although it deals with TableViewer you might get the idea:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=164797


Tom

Michael Moser schrieb:
I am using a table-tree viewer to observe the internal data structure of some object.
The use may collapse and expand this tree-view as desired to focus on particular elements in the tree.
If some data changes I fire a refresh on that tree (alas, there is no method to signal specifically which element has changed).


That refresh then always causes the entire tree to refresh - which I wouldn't mind since the speed is not a problem(, yet) - but this refresh also always expands/collapses the treeview to the expand level initially chosen. That means, that the user's selections and changes re. focus are lost and one has to search the particular tree-element one is interested in again (and since there are lots of changes this is simply unacceptable from a usability point of view).

Can one somehow trigger a refresh, but only of those elements that are currenly visible, i.e. leave the current expansion of subelements alone?

Hope I could make myself clear...

Michael