1

How can I get the content of a specific view ? For instance, I want to get the size of a table in a view. I only have the view ID wanted and more globally the workbench. I cannot modify the original RCP project.

Thanks

4

1 回答 1

2

您可以使用org.eclipse.ui.IWorkbenchPage.findView(String)返回 IViewPart(创建该视图的贡献对象的实例)。从那里,你必须知道并有权访问类和内部来获取它们的 Tree 对象:

IViewPart part = workbench.getActiveWorkbenchWindow().getActivePage()
    .findView(MyView.ID);
if (part instanceof MyView) {
    MyView view = (MyView) part;
    // now access whatever internals you can get to
}
于 2013-06-18T12:41:49.443 回答