Eclipse RCP open view programmatically the e4 way

六眼飞鱼酱① 提交于 2019-12-25 08:28:04

问题


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

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

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

What is the e4 way to do so?


回答1:


In e4 you open any part using EPartService:

@Inject
EPartService partService;


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

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).



来源:https://stackoverflow.com/questions/42319866/eclipse-rcp-open-view-programmatically-the-e4-way

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