Eclipse RCP开发剪辑之perspective
来源:互联网 发布:有什么情侣装淘宝店 编辑:程序博客网 时间:2024/04/29 03:58
1、使用org.eclipse.ui.perspectives 扩展点定义透视图的相关信息,使用org.eclipse.ui.views定义view的相关信息。定义完成,在一个实现了 IPerspectiveFactory接口的类里添加view,在添加的时候定义view的布局,如下:
class="com.ibm.demo.saic.MainPerspective"
id="com.ibm.demo.saic.MainPerspective"
name="MainPerspective"/>
point="org.eclipse.ui.views">
class="com.ibm.demo.saic.ui.views.TreeView"
id="com.ibm.demo.saic.ui.views.TreeView"
name="TreeView"/>
class="com.ibm.demo.saic.ui.views.WelcomeView"
id="com.ibm.demo.saic.ui.views.WelcomeView"
name="WelcomeView"/>
public static String ID="com.ibm.demo.saic.MainPerspective";
public void createInitialLayout(IPageLayout layout) {
layout.setEditorAreaVisible(false);
layout.addView(TreeView.ID, IPageLayout.TOP,
0.25f, layout.getEditorArea());
layout.setEditorAreaVisible(false);
/*layout.addView(LoginView.ID,IPageLayout.LEFT,
1f,layout.getEditorArea());*/
layout.addView(WelcomeView.ID,IPageLayout.LEFT,
1f,layout.getEditorArea());
IViewLayout vl=layout.getViewLayout(WelcomeView.ID);
//设置View不可关闭
layout.getViewLayout(WelcomeView.ID).setCloseable(false);
//设置View不可移动
layout.getViewLayout(WelcomeView.ID).setMoveable(false);
}
}
2, 使用org.eclipse.ui.perspectiveExtensions扩展点,向某个perspective里添加view,并设置布局。(说明:需要先定义好perspective和view)
closeable="false"
id="com.ibm.demo.saic.ui.views.LoginView"
moveable="false"
ratio="1f"
relationship="left"
relative="org.eclipse.ui.editorss"
visible="true"/>
public static String ID="com.ibm.demo.saic.LoginPerspective";
public void createInitialLayout(IPageLayout layout) {
layout.setEditorAreaVisible(false);
}
}
关闭当前perspective,并打开一个新的perspective:
ActionFactory.IWorkbenchAction closePerspectiveAction
= ActionFactory.CLOSE_PERSPECTIVE.create(w.getActiveWorkbenchWindow());
closePerspectiveAction.run();
try {
PlatformUI.getWorkbench().showPerspective("com.ibm.demo.saic.ui.views.NextPerspective", w.getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
e.printStackTrace();
}
IPerspectiveRegistry pr=w.getPerspectiveRegistry() ;
IPerspectiveDescriptor persdes=pr.findPerspectiveWithId("perspectiveID");
WorkbenchPage p=(WorkbenchPage)w.getActiveWorkbenchWindow().getActivePage();
Perspective persp = p.getActivePerspective();
p.closePerspective(persdes,false,false);
try {
w.showPerspective("nextperspectiveID", w.getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
e.printStackTrace();
}
- Eclipse RCP开发剪辑之perspective
- Eclipse RCP之perspective
- Eclipse RCP开发设置透视图(Perspective)
- Eclipse RCP perspective 最大化设置
- eclipse开发RCP之三
- Eclipse的rcp插件,在Perspective中添加ViewPart无效
- Eclipse RCP开发基础
- Eclipse RCP开发基础
- Eclipse RCP开发常见问题
- Eclipse RCP开发基础
- Eclipse RCP 之 状态栏
- Eclipse RCP 之国际化
- eclipse-rcp之简述
- RCP开发异常之org.eclipse.core.runtime.CoreException
- RCP中透视图Perspective切换
- Eclipse RCP开发桌面程序
- Eclipse RCP开发桌面程序
- Eclipse RCP开发桌面程序
- c语言编程如何实现-十进制数转换成二进制和输出
- 中国软件技术英雄会特邀嘉宾参会名单
- 这是我的故事
- 拖动窗口任意位置移动窗口(网上找的没有整理)
- 查看HP-UX内核参数命令
- Eclipse RCP开发剪辑之perspective
- Ref和Out的用法讨论二
- 慢几拍
- 太阳照常升起 之 梁老师为什么自杀?(原创)
- 对天乙社区bbscs8实现的详细分析一
- HP学习笔记
- 从java中的hibernate看Ado.net 与NHibernate的关系
- 异步调用Web服务
- 从一个表插入另一个相同结构表的数据