JFace: Set selection index in TableViewer

Veröffentlicht von

Selecting a row by index in a table viewer isn’t very straightforward. There is no method like tableViewer.setSelectionIndex.

Here is a snippet how its done:

int selection = 5; //row we want to select
tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(selection)),true);

Kommentar hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert