[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Problems with TableViewer VIRTUAL on MAC

Hi, Alessandro,

According to the Javadoc of setSelection:

void org.eclipse.jface.viewers.Viewer.setSelection(ISelection selection)

The viewer implementation of this ISelectionProvider method make the new selection for this viewer without making it visible.

This method is equivalent to setSelection(selection,false).

Note that some implementations may not be able to set the selection without also revealing it, for example (as of 3.3) TreeViewer.

I.e. the method does not have to reveal the selection, even though on some platforms it does. What you want is to change your call to:

tableViewer.setSelection(new StructuredSelection(input[input.length-1]), true);


â add ", true" as the last argument:


void org.eclipse.jface.viewers.TableViewer.setSelection(ISelection selection, boolean reveal)

Sets a new selection for this viewer and optionally makes it visible. The TableViewer implementation of this method is inefficient for the ILazyContentProvider as lookup is done by indices rather than elements and may require population of the entire table in worse case.

Use Table#setSelection(int[] indices) and Table#showSelection() if you wish to set selection more efficiently when using a ILazyContentProvider.


--
Andrey.