问题
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