Initial selection problem on TableViewer [message #459314] |
Fri, 05 August 2005 08:13  |
Eclipse User |
|
|
|
Hi all,
I'm using a TableViewer control on a WizardPage. On createControl I
construct
the TableViewer as normal:
viewer = new TableViewer( comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
viewer.setContentProvider( new MyContentProvider() );
viewer.setLabelProvider( new MyLabelProvider() );
viewer.setInput( myRootModelObject );
Now, the simple thing I want to achieve is to set the selection on the
viewer based on a selection made on another view (they share the same
model) by the user. So, supposedly my getUserSelection service gets the
user selection, all I have to do is to:
ISelection selection = getUserSelection();
viewer.setSelection(selection, true);
Unfortunately, this does not work, simply because the viewer is not yet
populated with elements at the time the setSelection method is called (on
createControl).
Is there a way to be notified that the viewer has been populated in order
to call setSelection right after?
Any help would be appreciated.
Thank a lot.
|
|
|
|
|
Re: Initial selection problem on TableViewer [message #459334 is a reply to message #459333] |
Fri, 05 August 2005 17:17  |
Eclipse User |
|
|
|
Unfortunately, there is no way to check when the table viewer is
populated. I could only start a timer inside ContentProvider's
getElements(Object inputElement) with a reasonable hit time in order to be
"certain" that the population is done. It is suprisingly weird how such a
simple feature is so difficult to implement. Unless i'm missing something
basic about TableViewer's working.
|
|
|
Powered by
FUDForum. Page generated in 0.02760 seconds