【问题标题】:Getting the content of a view Eclipse RCP获取视图 Eclipse RCP 的内容
【发布时间】:2013-06-13 15:05:21
【问题描述】:

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

谢谢

【问题讨论】:

    标签: eclipse view rcp workbench


    【解决方案1】:

    您可以使用 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
    }
    

    【讨论】:

    • 感谢您的准确回答,一切正常:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 2014-12-20
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    • 2011-03-25
    相关资源
    最近更新 更多