I have a TableViewer
in a view
of my RCP application. The TableViewer
has a List
of objects
as input. Is it possible to make a selection
for a particular object using the index of the object in the List that I set as input to the TableViewer
? For example, I want to set a default selection to the third object every time I open my application. How do I set that selection?
Asked
Active
Viewed 4,660 times
4

Rajath
- 2,178
- 6
- 32
- 38
1 Answers
12
Found the answer!
int selection = 5; //row we want to select
tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(selection)),true);
Thanks to http://andy.ekiwi.de/?p=1040.
-
it will work properly but how to invoke the selection event with that , I want to draw a UI based on the selection, Thanks – Promod Kumar Nov 13 '20 at 22:00