如何在Eclipse RCP E4(而非E3)中以编程方式重置透视图 [英] How to reset perspective programmatically in Eclipse RCP E4 not E3
本文介绍了如何在Eclipse RCP E4(而非E3)中以编程方式重置透视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在RCP应用程序中添加了2个透视图。我可以毫无问题地从一个切换到另一个。
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.
-
PlatformUI.getWorkbench()。getActiveWorkbenchWindow()。getActivePage()。resetPerspective(); > code>
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().resetPerspective();
此操作无效,因为我使用的是E4。
this didn't work because I use E4.
-
-clearPersistedState -persistState false
-clearPersistedState -persistState false
不是解决方案,因为我需要在不重新启动应用程序的情况下进行重置。
is not a solution cause I need to reset without restart my App.
推荐答案
使用<$ c EModelService
的$ c> resetPerspective 方法:
Use the resetPerspective
method of EModelService
:
public void resetPerspectiveModel(MPerspective persp, MWindow window)
请注意 PlatformUI
和关联的API不能在纯e4应用程序中使用。
Note that PlatformUI
and associated APIs can't be used in a pure e4 application.
这篇关于如何在Eclipse RCP E4(而非E3)中以编程方式重置透视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文