简体   繁体   English

Eclipse RCP,向编辑器添加新的视图

[英]Eclipse RCP, adding a new View to Editor

How is it possible to put a View into an Editor. 如何将视图放入编辑器。 Something like: 就像是:

public class Perspective implements IPerspectiveFactory {
public static final String ID = "com.example.gui.perspective";
public void createInitialLayout(IPageLayout layout) {
    layout.setEditorAreaVisible(true);
    String editorArea = layout.getEditorArea(); 
    layout.addView(View.ID, IPageLayout.TOP, 0.6f, IPageLayout.ID_EDITOR_AREA);    
... 
}

But there are only IPageLayout.TOP, IPageLayout.BOTTOM, IPageLayout.LEFT and IPageLayout.RIGHT options. 但是只有IPageLayout.TOP,IPageLayout.BOTTOM,IPageLayout.LEFT和IPageLayout.RIGHT选项。 I want to put it inside. 我要放进去 How is it possible? 这怎么可能?

It is impossible. 是不可能的。 Eclipse clearly distinguishes the editor area , which contains only editors , from all other areas, which contain only views . Eclipse清楚地区分了仅包含编辑器编辑器区域与仅包含视图的所有其他区域。

You tell Eclipse about an editor using the org.eclipse.ui.editors extension point: 您使用org.eclipse.ui.editors扩展点告诉Eclipse编辑器:

<extension
     point="org.eclipse.ui.editors">
  <editor
        name="Sample Multi-page Editor"
        extensions="mpe"
        icon="icons/sample.gif"
        contributorClass="tested.editors.MultiPageEditorContributor"
        class="tested.editors.MultiPageEditor"
        id="tested.editors.MultiPageEditor">
  </editor>
</extension>

It is impossible. 是不可能的。 You can add a view in a perspective when you initialize the perspective. 初始化透视时,可以在透视图中添加视图。

However, I think it's possible to notify the perspective to add a view when you initialize the editor. 但是,我认为可以在初始化编辑器时通知透视图添加视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM