2014-10-07 25 views
0

我开发了一个eclipse RCP插件,该插件旨在作为Eclipse应用程序运行,并且可以作为独立的Eclipse产品提取。现在,我想通过将其添加为插件来重复使用它,以便可以在eclipse中访问它。像模式窗口一样打开Eclipse插件视图

我可以将其安装到我的eclipse工作区,并可以通过看到视图窗口>显示视图。然而,视图打开到编辑器下方的区域(与控制台视图一起),而不是作为独立窗口打开。

请指点一下,视图在单独的窗口中打开,就像'搜索'窗口一样。

视图延伸'ViewPart'并使用复合材料。从 相关位的plugin.xml如下:

<extension id="application" point="org.eclipse.core.runtime.applications"> 
     <application> 
     <run class="xxx.Application"></run> 
     </application> 
</extension> 
<extension point="org.eclipse.ui.perspectives"> 
     <perspective name="xxxReview.perspective" class="extension.Perspective" id="xxxReview.perspective"> 
     </perspective> 
</extension> 
<extension point="org.eclipse.ui.views"> 
     <view class="view.xxxView" id="xxxView" name="xxxView" restorable="true"> 
     </view> 
</extension> 

回答

0

最后通过扩展SWT对话框使它工作。

public class xxxView extends Dialog { 

    /** The file Name Text field. */ 
    private Text fileNameText; 

    /** The constructor. **/ 
    protected xxxView(Shell parentShell) { 
     super(parentShell); 
    } 

    /** Create Dialog View. **/ 
    protected Control createDialogArea(Composite parent) { 

     //Added View components here. 
    } 
} 
0

如果你有自己的角度定义,你总是可以覆盖

public void createInitialLayout(IPageLayout layout) { 
    layout.addStandaloneView(xxxView, false, IPageLayout.TOP, 0.04f, IPageLayout.ID_EDITOR_AREA); 
    ... 
} 

如果您需要的视图。在一些本地的Eclipse可用透视图,试用perspectiveextensions与独立视图

<extension point="org.eclipse.ui.views"> 
    <view class="view.xxxView" id="xxxView" name="xxxView" restorable="true" /> 
</extension> 

<extension point="org.eclipse.ui.perspectiveExtensions"> 
    <perspectiveExtension targetID="*"> 
     <view id="xxxView" visible="false" standalone="true" 
      relative="org.eclipse.ui.views.ResourceNavigator" relationship="bottom" /> 
    </perspectiveExtension> 
</extension> 

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_ui_perspectiveExtensions.html

+0

我已经定义的透视如'layout.addStandaloneView( “xxxView”,假,IPageLayout.TOP,IPageLayout.RATIO_MAX,IPageLayout.ID_EDITOR_AREA);'。这使得视图在作为应用程序打开时是独立的。但是,如果在eclipse中将视图直接打开(在将其安装为插件后),则会在父eclipse窗口(编辑器/控制台区域)中打开。 – 2014-10-08 04:29:03