How to reset perspective programmatically in Eclipse RCP E4 not E3

寵の児 提交于 2019-12-11 09:03:22

问题


I just added 2 perspectives in my RCP App. I can switch from one to another without problems.

But I didn't find a way to reset perspective, for example if I close a Part excidently I need to reset my perspective.

  1. PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().resetPerspective();

this didn't work because I use E4.

  1. -clearPersistedState -persistState false

is not a solution cause I need to reset without restart my App.


回答1:


Use the resetPerspective method of EModelService:

public void resetPerspectiveModel(MPerspective persp, MWindow window)

Note that PlatformUI and associated APIs can't be used in a pure e4 application.



来源:https://stackoverflow.com/questions/51810853/how-to-reset-perspective-programmaticly-in-eclipse-rcp-e4-not-e3

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