【问题标题】:Disable close function for a view in a RCP application禁用 RCP 应用程序中视图的关闭功能
【发布时间】:2017-12-23 08:14:43
【问题描述】:

我有一个具有不同视角的 RCP 应用程序。从一个角度来看,有几种视图被定义为:

    p_layout.addStandaloneView(View1.ID, true, IPageLayout.LEFT, lf_ratioView1, p_layout.getEditorArea());
    p_layout.addStandaloneView(MyView.ID, false, IPageLayout.TOP, lf_ratioMyView, View1.ID);
    final IFolderLayout lf_detailsFolder = p_layout.createFolder("Details", IPageLayout.RIGHT, lf_ratioDetailsView, View1.ID);
    lf_detailsFolder.addPlaceholder(DetailsView.ID);
    lf_detailsFolder.addPlaceholder(View2.ID);
    lf_detailsFolder.addPlaceholder(View3.ID + ":*");
    lf_detailsFolder.addView(View4.ID);
    p_layout.addStandaloneView(View 5.ID, true, IPageLayout.BOTTOM, lf_ratioView5, "Details");
    p_layout.addStandaloneView(View6.ID, false, IPageLayout.BOTTOM, lf_ratioView6, View5.ID);

其中 p_layout 是一个 IPageLayout 对象。 这些视图可以通过按不同的按钮来关闭和打开。

我想禁用 FolderLayout 中视图的关闭选项:DetailsView、View2、View3 和 View 4,以便用户只能使用这些按钮关闭它们。

我尝试将plugin.xml中视图扩展点的可关闭属性设置为true,但没有成功。

我也通过代码试过了:

    p_layout.getViewLayout(DetailsView.ID).setCloseable(false);
    p_layout.getViewLayout(View2.ID).setCloseable(false);
    p_layout.getViewLayout(View3.ID).setCloseable(false);
    p_layout.getViewLayout(View24.ID).setCloseable(false);

也没有用。

RCP 应用程序是从 Eclipse Mars 构建的。

【问题讨论】:

  • 视图扩展点没有“可关闭”属性。如果您的意思是 perspectiveExtension 扩展点不使用它来引用您已经在透视工厂中定义的视图,它将导致未定义的行为。

标签: view swt eclipse-rcp eclipse-mars


【解决方案1】:

显然,我不想关闭的每个视图的 setCloseable(false) 方法是正确答案。

我已启动应用程序并激活了“清理工作区”属性,以便该功能生效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多