RAP Perspective Bar(透视图栏 右上角)

来源:互联网 发布:外勤人员考勤软件 编辑:程序博客网 时间:2024/05/16 10:47

  RAP 1.3  要实现在workbench中显示perspective bar,只需要在继承WorkbenchWindowAdvisor的子类中preWindowOpen();中设置,代码如下:

值得注意的是如果想要让perspectiveBar出现在右上角(如下图所示),

 

则必须设置setShowCoolBar(true); and setShowPerspectiveBar(true); 因为perspectiveBar默认在右上角,也可以通过下面代码设置bar位置

 

PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,IWorkbenchPreferenceConstants.TOP_RIGHT);

 

参数:IWorkbenchPreferenceConstants.TOP_RIGHT  ----  右上角

         IWorkbenchPreferenceConstants.TOP_LEFT    ----- 左上角

         IWorkbenchPreferenceConstants.LEFT            ----- 左面 

 

但是如果setShowCoolBar(false); and setShowPerspectiveBar(true);则perspectiveBar将会在左面出现,就是通过参数设置也是无法使perspectiveBar放到右上角,解决的办法是可以setShowCoolBar(true);根据需要可以在coolBar中设置actions。