簡體   English   中英

Eclipse RCP-相對視野透視擴展無效

[英]Eclipse RCP - relative field of view perspective extension not working

問候Stackoverflownians,

當前正在開發Eclipse RCP應用程序。

重置透視圖時,我試圖將視圖顯示在正確的位置。

在我的plugin.xml中:

<perspectiveExtension
            targetID="the.perspective.id">
         <view
               id="the.first.view.id"
               relationship="stack"
               relative="org.eclipse.ui.navigator.ProjectExplorer"
               visible="false">
         </view>
         <view
               id="the.second.view.id"
               relationship="left"
               relative="org.eclipse.ui.navigator.ProjectExplorer"
               visible="true">
         </view>
      </perspectiveExtension>

在視圖擴展點中聲明第一和第二視圖的位置。

根據eclipse.org

stack表示該視圖將與相對視圖堆疊在一個文件夾中

問題是,當我重置透視圖時,我將視圖放置在一個單獨的位置(更確切地說是在右側),占據了約50%的工作台。

是否應該在我的plugin.xml中再次聲明ProjectExplorer視圖,以便relative字段的stack值起作用?

編輯:我看過另一個插件項目

<view
              id="org.eclipse.search.ui.views.SearchView"
              minimized="false"
              relationship="stack"
              relative="dreisoft.tresos.launcher2.api.views.ErrorLog"
              visible="false">
        </view>

這似乎可行,我查看了IPerspectiveFactory ,並且createInitialLayout為空。 盡管如此,這仍然有效。

肅然,

弗拉德

這有點奇怪。 我前一段時間嘗試過您的方法,但對我也不起作用。 而是采用程序化方法。

通過使用您的PerspectivecreateInitialLayout方法中收到的IPageLayout ,嘗試創建IPlaceholderFolderLayout

final IPlaceholderFolderLayout folder = layout.createPlaceholderFolder("main.editor.area", IPageLayout.TOP, 0.8f, layout.getEditorArea()); //$NON-NLS-1$

您可以借助這些參數將每個視圖放置在該文件夾中。 然后將視圖添加到該文件夾​​:

folder.addPlaceholder("your.view.ID" + ":*"); //$NON-NLS-1$

我建議您使ID的static final String常量。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM