Eclipse RCP以e4方式以编程方式打开视图 [英] Eclipse RCP open view programmatically the e4 way

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

问题描述

我想以编程方式(从上下文菜单中)打开某个视图,我该怎么做?

I would like to programmatically (from a context menu) open a certain view How can I do so?

我可以使用这样的e3兼容层显示视图:

I can show a view using e3 compatibility layer like this:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("viewId");

这样做的e4方法是什么?

What is the e4 way to do so?

推荐答案

在e4中,您可以使用 EPartService 打开任何零件:

In e4 you open any part using EPartService:

@Inject
EPartService partService;


partService.showPart("part id", PartState.ACTIVATE);

该部分应位于Application.e4xmi中您要显示的位置,但应具有 待渲染关闭(保持可见打开。)

The part should be in the Application.e4xmi in the place you want it to show but should have 'To Be Rendered' turned off (leave 'Visible' on).

这篇关于Eclipse RCP以e4方式以编程方式打开视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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