Question

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

Was it helpful?

Solution

You can use org.eclipse.ui.IWorkbenchPage.findView(String) to return the IViewPart (the instance of the contributed object that created that view). From there, you would have to know and have access to the class and internals to get ahold of their Tree object:

IViewPart part = workbench.getActiveWorkbenchWindow().getActivePage()
    .findView(MyView.ID);
if (part instanceof MyView) {
    MyView view = (MyView) part;
    // now access whatever internals you can get to
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top