RCP 透视图列表栏(PerspectiveBar)居右上角

1.在RCP中ApplicationWorkbenchWindowAdvisor的preWindowOpen()中添加:
configurer.setShowPerspectiveBar(true);//表示显示透视图栏

2.在RCP配置product文件后,在plugin_customization.ini中添加:
------
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false 
org.eclipse.ui/DOCK_PERSPECTIVE_BAR=TOP_RIGHT

------
其中第一句:表示RCP中的Tab的显示不是规则的普通类型,而是带有弧线的过渡类型
第二句:是指定透视图栏的位置在ToP_RIGHT顶层靠右,类似Eclipse的透视图效果。

3.RCP项目中如果用到多个透视图可在各个透视图实现类中加入透视图标签列表
public class MYPerspective implements IPerspectiveFactory {
 public static final String ID ="org.xxx.MYPerspective";
 @Override
 public void createInitialLayout(IPageLayout layout) {
  layout.setEditorAreaVisible(true);

  //增加透视图标签
  layout.addPerspectiveShortcut(ID);
  layout.addPerspectiveShortcut(MYPerspective1.ID);
  layout.addPerspectiveShortcut(MYPerspective2.ID);
  layout.addPerspectiveShortcut(MYPerspective3.ID);

 }
}

//多个透视图类
public class MYPerspective1 implements IPerspectiveFactory {//.......}
public class MYPerspective2 implements IPerspectiveFactory {//.......}
public class MYPerspective3 implements IPerspectiveFactory {//.......}

猜你喜欢

转载自niub.iteye.com/blog/1787622