eclipse rcp显示视图定位

 时间:2026-02-15 00:08:34

1、首先建立一个插件项目,新手可以看一下链接。

2、新建一个viewpart视图,不熟悉怎么建立视图看一下上个经验。本次用的视图Vpyuyuedengji.ID.

https://jingyan.baidu.com/article/8ebacdf06ef6ea49f75cd566.html

eclipse rcp显示视图定位

3、我在菜单中打开视图,代码如下(没有定位视图的区域,rcp系统指定区域显示视图。):

try {

    IWorkbenchPage ap = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

    ap.showView(Vpyuyuedengji.ID);

} catch (PartInitException e1) {

MessageDialog.openInformation(null, "提示", "系统出现错误不能打开预约登记的视图!");

}

eclipse rcp显示视图定位

eclipse rcp显示视图定位

eclipse rcp显示视图定位

4、打开Perspective这个文件,找到createInitialLayout这个方法,添加代码:

IFolderLayout bottom=layout.createFolder("bottom", IPageLayout.BOTTOM, 0.85f, IPageLayout.ID_EDITOR_AREA);

bottom.addPlaceholder(Vpyuyuedengji.ID);

这个命令是在“bottom”这个区域中显示视图。

eclipse rcp显示视图定位

eclipse rcp显示视图定位

5、在createInitialLayout这个方法添加代码,在左面区域中显示视图:

IFolderLayout left=layout.createFolder("left", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA);

left.addPlaceholder(Vpyuyuedengji.ID);

eclipse rcp显示视图定位

eclipse rcp显示视图定位

6、在右面区域中显示视图:

IFolderLayout right=layout.createFolder("right", IPageLayout.RIGHT, 0.85f, IPageLayout.ID_EDITOR_AREA);

right.addPlaceholder(Vpyuyuedengji.ID);

eclipse rcp显示视图定位

7、在不同区域打开同一个视图:

IFolderLayout left=layout.createFolder("left", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA);

left.addView(Vpyuyuedengji.ID+":1");

IFolderLayout right=layout.createFolder("right", IPageLayout.RIGHT, 0.85f, IPageLayout.ID_EDITOR_AREA);

right.addView(Vpyuyuedengji.ID+":2");

IFolderLayout bottom=layout.createFolder("bottom", IPageLayout.BOTTOM, 0.85f, IPageLayout.ID_EDITOR_AREA);

bottom.addView(Vpyuyuedengji.ID+":3");

eclipse rcp显示视图定位

eclipse rcp显示视图定位

  • Eclipse之Pydev,Unable to read repository at.
  • JSP如何使用out对象
  • 图解Maven 3.6配置及验证步骤
  • Oracle Job 定时器的简单用法
  • putty key generator公钥和私钥怎么区别?
  • 热门搜索
    窗纱怎么清洗 如何做ppt模板 如何配眼镜 微信网页版怎么登陆 大熊猫的生活 诅咒之地怎么去 philips是什么牌子 如何治疗褥疮 怎么设计网页 生活月刊