Eclipse RCP - 相对视野透视扩展不起作用 [英] Eclipse RCP - relative field of view perspective extension not working

查看:448
本文介绍了Eclipse RCP - 相对视野透视扩展不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候同事Stackoverflownians,

Greetings fellow Stackoverflownians,

目前正在开发Eclipse RCP应用程序。

Currently developing an Eclipse RCP app.

我试图做视图重新设置时,视图会出现在正确的位置。

I'm trying to make a view appear in the right place when the perspective is reset.

在我的plugin.xml中:

In my 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>

在视图扩展点中声明第一个和第二个视图。

Where the first and second views are declared in the views extension point.

根据 eclipse.org


堆栈表示视图将堆叠在一个文件夹中的相对视图

stack indicates that the view will be stacked with the relative view in a folder

问题是当我重置透视图时,我将视图放在一个单独的位置更精确地说,在右边)占用工作台的大约50%。

The issue is that when I reset the perspective, I get the view in a separate place (more exactly, to the right) occupying ~50% of the workbench.

如果在我的plugin.xml中再次声明了ProjectExplorer视图,那么 stack 相对字段的值可以正常工作?

Should the ProjectExplorer view be declared once more in my plugin.xml, so that the stack value of the relative field would work?

编辑:我在另一个插件项目中查看

I've looked in another plugin project

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

这似乎工作,我看过 IPerspectiveFactory ,而 createInitialLayout 为空。

This seems to work, and I've looked in the IPerspectiveFactory, and the createInitialLayout is empty. Despite that, this works.

尊敬的你,

Vlad

推荐答案

这有点奇怪。我曾经尝试过你的方法,也没有为我工作。相反,采取程式化的方法。

This is a bit odd. I've tried your method a while ago and it didn't work for me either. Instead, take a programmatical approach.

使用 IPageLayout ,您将收到 透视图中的createInitialLayout 方法,尝试创建一个 IPlaceholderFolderLayout

With the use of the IPageLayout you receive in the createInitialLayout method of your Perspective, try creating a IPlaceholderFolderLayout:

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

您可以通过帮助下的每个视图在该文件夹中那些参数。
然后将您的视图添加到该文件夹​​:

You can position each view in that folder with the help of those parameters. Then add your view to that folder:

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

我建议你让 static final字符串您的ID的常量。

I recommend you make static final String constants of your IDs.

这篇关于Eclipse RCP - 相对视野透视扩展不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆