关于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项目却出现 ...
随机推荐
- FZU 2082 过路费 (树链剖分 修改单边权)
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2082 树链剖分模版题,求和,修改单边权. #include <iostream> #include ...
- C#学习笔记(十二):正则表达式
Regex 正则表达式的类,我们可以通过该类来使用正则表达式. 比如下面我们使用Regex来判断输入的字符串是否符合指定的格式: using System; using System.Text.Reg ...
- poj 3501 Escape from Enemy Territory 二分+bfs
水题,不解释. #include<stdio.h> #include<math.h> #include<cstring> #include<algorithm ...
- 《解剖PetShop》系列转载
1 <解剖PetShop>系列之六 PetShop之表示层设计 http://ityup.com/showtopic-8.html 2 <解剖PetShop>系列之五 ...
- 剑指OFFER之数值的整数次方(九度OJ1514)
题目描述: 给定一个double类型的浮点数base和int类型的整数exponent.求base的exponent次方. 输入: 输入可能包含多个测试样例.对于每个输入文件,第一行输入一个整数T,表 ...
- Oracle-11g 从表空间删除数据文件
从表空间删除数据文件前提条件 如果欲从表空间中删除数据文件,那么该数据文件必须为空,否则将报出"ORA-03262: the file is non-empty"的错误. 从表 ...
- ALT(预警)
1. Alert简介 Alert是一种Oracle系统中的一种机制,它可以监视系统数据库,在规定的情况下给规定用户一个通知,通知可以是邮件或者其他形式,在标注的系统和客户化系统中都是可以定义使用的 2 ...
- Unity3D-Baked Lightmapping 示例学习
首先,看一下摄像机的Rendering Paths http://game.ceeger.com/Manual/RenderingPaths.html 可以看出,对于灯光的渲染质量 Deferred ...
- exe文件当前目录搜索文件
方法: //std::string dir = "C:\\Users\\xzd\\Documents\\KinectFile\\2014-09-07\\Select\\mengyue\\&q ...
- android147 360 程序锁fragment
package com.itheima.mobileguard.fragment; import java.util.ArrayList; import java.util.List; import ...