Custom Eclipse perspective, with initially invisble view stacked to editor area

[亡魂溺海] 提交于 2019-11-30 23:24:20

Sometimes you can't imagine how simple solutions can be:

Simply adding :* at the end of the view id in the plugin.xml solved this issue:

<view
          id="my.viewID:*"
          minimized="false"
          relationship="stack"
          relative="org.eclipse.ui.editorss"
          visible="false">
</view>

Unbelievable how many times you find people saying this would not be possible at all...

Well, I've read most stuff about placing a view over the editor area, and none worked. The Answer 1 above causes the plugin.xml to have warnings. In Eclipse Luna, this works however when your perspective is initialized:

public void createInitialLayout(IPageLayout layout) {
  if ( layout instanceof org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout ) {
    org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout layout4=(org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout)layout;
    layout4.stackView(ID+":*",layout.getEditorArea(),false);
  }
  ...

The code above adds a view with "ID" that is a multiple view, added to the stack of editors hidden (last parameter is false="not visible").

It may also work with other Eclipse versions, but I haven't tried it.

Good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!