Getting the content of a view Eclipse RCP

℡╲_俬逩灬. 提交于 2020-01-05 09:53:36

问题


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


回答1:


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
}


来源:https://stackoverflow.com/questions/17151277/getting-the-content-of-a-view-eclipse-rcp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!