获取视图Eclipse RCP的内容 [英] Getting the content of a view Eclipse RCP

查看:53
本文介绍了获取视图Eclipse RCP的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取特定视图的内容?例如,我想获取视图中表的大小.我只有想要的视图ID,而更全局的是工作台.我无法修改原始的RCP项目.

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.

谢谢

推荐答案

您可以使用 org.eclipse.ui.IWorkbenchPage.findView(String)返回IViewPart(贡献对象的实例)创建了该视图).从那里,您将必须知道并有权访问类和内部,才能了解其Tree对象:

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
}

这篇关于获取视图Eclipse RCP的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆