Java 如何将TableViewer中的选择设置为指定索引?
我的RCP应用程序的Java 如何将TableViewer中的选择设置为指定索引?,java,eclipse-plugin,eclipse-rcp,Java,Eclipse Plugin,Eclipse Rcp,我的RCP应用程序的视图中有一个TableViewer。TableViewer有一个对象列表作为输入。是否可以使用列表中的对象索引为特定对象进行选择,我将该索引设置为TableViewer的输入?例如,我希望在每次打开应用程序时将默认选择设置为第三个对象。如何设置该选项?找到了答案 int selection = 5; //row we want to select tableViewer.setSelection(new StructuredSelection(tableViewer.getE
视图中有一个TableViewer
。TableViewer
有一个对象列表
作为输入。是否可以使用列表中的对象索引为特定对象进行选择
,我将该索引设置为TableViewer
的输入?例如,我希望在每次打开应用程序时将默认选择设置为第三个对象。如何设置该选项?找到了答案
int selection = 5; //row we want to select
tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(selection)),true);
感谢。它将正常工作,但是如何使用它调用选择事件,我想基于选择绘制一个UI,谢谢