プログラムで特定の行を選択したいNatTable
ISelectionProvider (この場合は org.eclipse.nebula.widgets.nattable.selection.RowSelectionProvider) を使用するサンプル コードが、NatTable サンプル プログラム(Classic Examples -> Selection -> Get and set selected objects の下) にあります。
ISelectionProvider selectionProvider = new RowSelectionProvider(gridLayer.getBodyLayer().getSelectionLayer(), bodyDataProvider, false);
selectionProvider.setSelection(new StructuredSelection(new Person[] { homer, smithers, nelson }));
別のソースから、行を選択するより簡単な方法を見つけました。
natTable.doCommand(new SelectRowsCommand(ILayer layer, int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask));
2 番目のアプローチを使用しない理由はありますか?