在TreeViewer中选择添加的项目

exe*_*ecc 2 java swt jface treeviewer

我有和添加按钮,TableViewer在我的应用程序中.按下" 添加"按钮后,我将向模型中添加一个新元素,然后刷新该查看器.

问题是:如何在我的查看器中选择这个新添加的项目?

p12*_*12t 6

tableViewer.setSelection(new StructuredSelection(modelElement), true);
Run Code Online (Sandbox Code Playgroud)

true在年底将会使表滚动到新选择的项目,如果需要的话.