关于Eclipse插件之IWorkbench IWorkbenchWindow IWorkbenchPage |WorkbenchPart......等的总结
当你的workbench插件被激活的时候,eclipse平台将为之创建一个实例,在平台的整个生命周期中,只允许出现该workbench的唯一实例
2..IWorkbenchWindow
上面提到IWorkbench利用其包含的IWorkbenchWindow向终端用户展现信息
"A workbench window is a top level window in a workbench. "
IWorkbenchWindow通常包含菜单栏,工具栏,状态栏和一个用来显示IWorkbenchPage的主要区域
每个IWorkbenchWindow可以包含一个或多个IWorkbenchPage,但是同一时刻只允许一个IWorkbenchPage被激活并向终端用户显示
3..IWorkbenchPage
IWorkbenchPage的功能就是组织一个或多个IEditorPart或IViewPart显示在一个IWorkbenchWindow中,最终呈现给终端用户
IWorkbenchPage包含一个或多个IEditorPart或IViewPart,这些IEditorPart和IViewPart完全被包含在这个IWorkbenchPage并且不能与其它的IWorkbenchPage共享
IWorkbenchPage上定义的Layout和ActionSet就是我们常说的透视图——perspective了
4..IWorkbenchPart
IWorkbenchPart就是上面提到的IEditorPart和IViewPart,它也只包含这两个子类型,看到这里大家应该明白,我们绝大部分的工作就是基于这个IWorkbenchPart
关于IEditorPart和IViewPart,相信大家应该已经十分了解了
IViewPart常常被用于导航信息的层次结构,例如我们的workspace,或者用来打开一个编辑器,或者用来显示这个编辑器的某些属性
IEditorPart多被用来编辑或浏览一个文档或一个输入的对象,而这个输入的对象必须是一个IEditorInput,IEditorPart遵循的就是打开-保存-关闭的生命周期模型
最后给出IWorkbenchPart的生命周期模型,希望对大家的开发能够有所帮助:
IWorkbenchPart拓展点被创建:
实例化IWorkbenchPart
创建一个IWorkbenchPartSite
调用part.init(site)
IWorkbenchPart成为可见:
调用part.createControl(parent)绘制 IWorkbenchPart
激活partOpened event
IWorkbenchPart被激活或者取得焦点:
调用part.setFocus()
激活partActivated event
IWorkbenchPart被关闭:
如需要保存,完成保存
解除IWorkbenchPart的激活状态
激活partClosed event
从界面上移除IWorkbenchPart
调用part.dispose()
关于IWorkbench 对象
public interface IWorkbench extends IAdaptable, IServiceLocator A workbench is the root object for the Eclipse Platform user interface. A workbench has one or more main windows which present to the end user information based on some underlying model, typically on resources in an underlying workspace. A workbench usually starts with a single open window, and automatically closes when its last window closes. Each workbench window has a collection of pages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time. Each workbench page has a collection of workbench parts, of which there are two kinds: views and editors. A page's parts are arranged (tiled or stacked) for presentation on the screen. The arrangement is not fixed; the user can arrange the parts as they see fit. A perspective is a template for a page, capturing a collection of parts and their arrangement. The platform creates a workbench when the workbench plug-in is activated; since this happens at most once during the life of the running platform, there is only one workbench instance. Due to its singular nature, it is commonly referred to as the workbench. The workbench supports a few services by default. If these services are used to allocate resources, it is important to remember to clean up those resources after you are done with them. Otherwise, the resources will exist until the workbench shuts down. The supported services are: IBindingService ICommandService IContextService IHandlerService This interface is not intended to be implemented by clients. See Also: PlatformUI.getWorkbench() Restriction: This interface is not intended to be implemented by clients.
关于PlatformUI对象
public final class PlatformUI extends Object The central class for access to the Eclipse Platform User Interface. This class cannot be instantiated; all functionality is provided by static methods. Features provided: creation of the workbench. access to the workbench. See Also: IWorkbench
关于IEclipseContext对象
org.eclipse.e4.core.contexts Interface IEclipseContext public interface IEclipseContext A context is used to isolate application code from its dependencies on an application framework or container. This helps avoid building in dependencies on a specific framework that inhibit reuse of the application code. Fundamentally a context supplies values (either data objects or services), and allows values to be set. Typically a client will be provided values from a context through injection, removing the need for clients to even depend on this interface. While a context appears superficially to be a Map, it may in fact compute values for requested keys dynamically rather than simply retrieving a stored value. Contexts may have a parent context, and may delegate lookup of a value to their parent. Whether a value is computed or stored in this context or a parent context is an implementation detail that clients need not be concerned with. The content of parent contexts cannot be modified by a child context. Contexts may have child contexts. Children inherit context values from their parent as described earlier. At any time, one of the children may be considered the active child. The interpretation of what active means depends on the domain in which the context is used. Like maps, values are stored in the context based on keys. Two types of keys can be used: strings and classes. When classes are used to access objects in the context, keys are calculated based on the class name, so the value stored for the class String can be retrieved using the key value of "java.lang.String". Since: 1.3 Restriction: This interface is not intended to be implemented by clients. Restriction: This interface is not intended to be extended by clients.
rcp(插件开发)如何打开编辑器、视图、透视图
如下:
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
1.打开编辑器
window.getActivePage().openEditor(input, Editor Id);
2.打开视图
window.getActivePage().showView(View Id);
3.打开透视图
PlatformUI.getWorkbench().showPerspective(Perspective Id,w.getActiveWorkbenchWindow());
关于Eclipse插件之IWorkbench IWorkbenchWindow IWorkbenchPage |WorkbenchPart......等的总结的更多相关文章
- Eclipse插件基础篇一
名词翻译 有一些名词在翻译的过程中可能会出现歧义,在这里统一一下. アーキテクチャ=architecture=架构 プラットフォーム=platform=平台 コンポーネント=component=组件 ...
- eclipse 插件编写(四)
前言 前面几篇文章讲了下如果编写简单的eclipse插件,如创建插件项目.编写右键弹出菜单等功能,接下来主要写一下如何生成代码的功能,这一片的功能跟插件本身的编写关联不太大,主要处理插件之后的业务内容 ...
- eclipse 插件编写(一)
由于项目开发进程中有一些重复性的代码进行编写,没有任何业务逻辑,粘贴复制又很麻烦且容易出错,故想起做一个eclipse插件来满足一下自己的工作需要,同时记录一下,以供以后参考与共同学习.本文主要讲解一 ...
- Hadoop2 自己动手编译Hadoop的eclipse插件
前言: 毕业两年了,之前的工作一直没有接触过大数据的东西,对hadoop等比较陌生,所以最近开始学习了.对于我这样第一次学的人,过程还是充满了很多疑惑和不解的,不过我采取的策略是还是先让环 ...
- Hadoop学习笔记—6.Hadoop Eclipse插件的使用
开篇:Hadoop是一个强大的并行软件开发框架,它可以让任务在分布式集群上并行处理,从而提高执行效率.但是,它也有一些缺点,如编码.调试Hadoop程序的难度较大,这样的缺点直接导致开发人员入门门槛高 ...
- 从零自学Hadoop(07):Eclipse插件
阅读目录 序 Eclipse Eclipse插件 新建插件项目 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写 ...
- Eclipse插件安装方式及使用说明
拷贝安装方式 1.通过ECLIPSE_HOME\plugins安装 在eclipse的主目录ECLIPSE_HOME, 比如在我的机器上安装的目录是:ECLIPSE_HOME有一个plugins的目录 ...
- Hadoop_配置_linux下编译eclipse插件
使用的hadoop版本为hadoop-1.2.1(对应的含源码的安装包为hadoop-1.2.1.tar.gz) 将hadoop和eclipse都解压在home中的用户目录下 /home/chen/h ...
- [Maven]Eclipse插件之Maven配置及问题解析.
前言:今天在自己环境装了Maven环境, 并且安装了Eclipse插件, 在查找插件过程中确实遇到一些问题, 好不容易找到一个 却又有问题.装好了插件之后, 用Eclipse创建Maven项目却出现 ...
随机推荐
- [转] GCC 中的编译器堆栈保护技术
以堆栈溢出为代表的缓冲区溢出已成为最为普遍的安全漏洞.由此引发的安全问题比比皆是.早在 1988 年,美国康奈尔大学的计算机科学系研究生莫里斯 (Morris) 利用 UNIX fingered 程序 ...
- work6
1) 把程序编译通过, 跑起来. 把正确的 playPrev(GoMove) 的方法给实现了. 如果大家不会下围棋,那就需要大家实地或者上网练习一下围棋的死活,提子是怎么回事.这个应该一个小时就能搞定 ...
- Oracle 查看表空间大小及其扩展
在ORACLE数据库中,所有数据从逻辑结构上看都是存放在表空间当中,当然表空间下还有段.区.块等逻辑结构.从物理结构上看是放在数据文件中.一个表空间可由多个数据文件组成.系统中默认创建的几个表空间:S ...
- 蓝桥杯 入门训练 Fibonacci数列
入门训练 Fibonacci数列 时间限制:1.0s 内存限制:256.0MB 问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1. ...
- ActiveMQ JMS 在发邮件中的使用
ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现,尽管JMS规范出台已经是很久 ...
- UI进阶 KVO
KVO:(Key-Value-Observer)键值观察者,是观察者设计模式的一种具体实现 KVO触发机制:一个对象(观察者),监测另一对象(被观察者)的某属性是否发生变化,若被监测的属性发生的更改, ...
- Spring MVC Framework 实例
一 SpringMVC基础入门,创建一个HelloWorld程序 1 首先,导入SpringMVC需要的jar包. commons-logging-<version>.jar spring ...
- 根据powerdesigner的OO模型生成C#代码
2007-05-15 08:34:11| 分类: 转贴部分 | 标签:学习帖子 |字号 订阅 习惯了用Powerdesigner设计数据库模型,XDE设计类图.因此我一般的设计方法是用PD做分析模 ...
- [Ruby01]Class, Module, Object,Kernel的关系
puts Class.ancestorsputs '11111111111111111111'puts Module.ancestorsputs '2222222222222222222'puts O ...
- JS 之如何在插入元素时插在原有元素的前面而不是末尾
语法: 父级.insertBefore(新元素,被插入的元素): //在指定的元素前面加入一个新元素 父级.insertBefore(新元素,父级.children[0]); //在 ...