【问题标题】:How to Reset Eclipse RCP perspective programmatically如何以编程方式重置 Eclipse RCP 透视图
【发布时间】:2016-02-10 17:35:01
【问题描述】:

我制作了 RCP 产品文件,每次都必须在其中重置视角。有什么方法可以在加载之前重置视角?

【问题讨论】:

    标签: eclipse eclipse-rcp


    【解决方案1】:

    如果您总是希望您的 RCP 以相同的状态启动,您可以指定标志

    -clearPersistedState -persistState false
    

    在 .product 文件的“启动”选项卡的“程序参数”部分中。

    -clearPersistedState 导致 Eclipse 在启动期间放弃所有持久化状态。

    -persistState false 停止 Eclipse 以在退出时保持状态。

    这仅适用于 Eclipse 4.x。

    【讨论】:

    • -clearPersistedState -persistState false 工作正常,但它也会清除保存的透视图。
    【解决方案2】:

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

    Eclipse 3.x - 对于 Eclipse 4.x,请参阅 greg 的回答。

    【讨论】:

    • resetPerspective() 并不总是重置透视图。
    猜你喜欢
    • 2014-12-10
    • 2019-01-19
    • 1970-01-01
    • 1970-01-01
    • 2013-11-12
    • 2013-03-02
    • 2012-08-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多