如何在 Eclipse RCP E4 而不是 E3 中以编程方式重置透视图

How to reset perspective programmatically in Eclipse RCP E4 not E3

我刚刚在我的 RCP 应用程序中添加了 2 个视角。我可以毫无问题地从一个切换到另一个。

但是我没有找到重置视角的方法,比如我突然关闭了一个Part我需要重置我的视角。

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

这没有用,因为我使用 E4。

  1. -clearPersistedState -persistState false

不是解决方案,因为我需要在不重启我的应用程序的情况下进行重置。

使用EModelServiceresetPerspective方法:

public void resetPerspectiveModel(MPerspective persp, MWindow window)

请注意,PlatformUI 和关联的 API 不能在纯 e4 应用程序中使用。