1
我在我的RCP应用程序的view
中有TableViewer
。 TableViewer
的List
为objects
作为输入。是否可以使用我设置为TableViewer
的输入的列表中的对象的索引为特定对象创建selection
?例如,我想在每次打开我的应用程序时为第三个对象设置默认选择。我如何设置选择?如何将TableViewer中的选择设置为指定的索引?
我在我的RCP应用程序的view
中有TableViewer
。 TableViewer
的List
为objects
作为输入。是否可以使用我设置为TableViewer
的输入的列表中的对象的索引为特定对象创建selection
?例如,我想在每次打开我的应用程序时为第三个对象设置默认选择。我如何设置选择?如何将TableViewer中的选择设置为指定的索引?
找到答案!
int selection = 5; //row we want to select
tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(selection)),true);
+ 1,但请记得首先调用'tv.getTable()。setFoucs()'。 –