- 浏览: 79465 次
- 性别:
- 来自: 四川
最近访客 更多访客>>
最新评论
-
alanland:
不应该是形状把
scala翻译,难度大 -
zjf_sdnu:
up一下!《实用Common Lisp编程》http://we ...
初步介入common lisp殿堂 -
wislin:
你的博客速度好快咯,以后可以互相学习。
初步介入common lisp殿堂 -
albertlee:
好吧,广告个Lisp的blog: www.feime.net ...
初步介入common lisp殿堂 -
weishuang:
哥们挺有幽默感的么
送给奋斗中的哥们儿们 !
简介
在Eclipse平台里,一个workbench包含一个workbench window集合。每个workbench window包含一个以上的page,每个page包含一个editor和view的集合。一个editor主要用于编辑和查看文档或输入对象(input object)。对editor进行变更,接下来就是open-save-close 生命周期模式。一个view主要用于遍历结构化信息、打开一个editor或显示一个激活editor的属性。与editor相比,view的变更立即得到保存。editor和view在page里面的布局是通过perspective来完成的。
在workbench里面包括了许多的描述view功能的标准部件。例如,Navigator view就是用于显示和导航workspace。假如在导航器(Navigate)里选定了一个文件,那么你可以打开一个editor,并显示该文件的内容。一旦editor打开,就可以使用Outline view来显示文档的结构化信息,使用properties view来修改文档的属性。
增加一个新view
向workbench里面添加一个view,只需要简单的三步:
1.创建一个插件;
2.增加一个view extension 到 plugin.xml里面;
3.为这个extension定义一个view类
第一步:创建一个插件
此时,plugin.xml里面的内容为:
第二步:往plugin.xml增加一个view扩展
`其中
id- 唯一标识符用来描述这个view
name - 可以在UI里面显示的名字
class- a fully quified name,这个类implements org.eclipse.ui.IViewPart.一般情况下,都是从org.eclipse.ui.part.ViewPart类继承下来。
icon - 用于这个view的图片的相对路径
第三步:定义该类
view的生命周期
当一个view被添加到workbench page里面时,其生命周期就开始了。如果用户从Perspective->Show View启动view,则生命周期始于于page创建的过程中,或创建之后。以下任何一步被执行都导致view生命周期的开始:
(1)An instance of the view class is instantiated.
(2)The IViewPart.init method is called to initialize the context for the view. An IViewSite object is passed, and contains methods to get the containing page, window, and other services is passed.
(3)The IViewPart.createPartControl method is called. Within this method the view can create any number of SWT controls within a parent Composite. These provide the presentation for some underlying, view specific model.
当view被关闭时,生命周期也就终止了。
(1)The parent Composite passed to createPartControl is disposed.This children are also implicitly disposed. If you wish to run any code at this time, you must hook the control dispose event.
(2)The IViewPart.dispose method is called to terminate the part liflecycle. This is the last method which the workbench will call on the part. It is an ideal time to release any fonts, image.etc.
为什么不能够通过API来声明View呢?
所有用于workbench里面的views都必须用XML来声明,理由有以下两点:
1.在eclipse里面,一个extension的presence都是用XML来声明的。
2.view的声明也是用于workbench的持久化。当workbench被关闭时,workbench里面的所有的view的ID和position都被存储到文件里,It is possible to save the specific view class. However, the persistence of class names in general is brittle, so view id's are used instead. On startup, the view id is mapped to a view extension within the plugin registry. Then a new instance of the view class is instantiated.
在Eclipse平台里,一个workbench包含一个workbench window集合。每个workbench window包含一个以上的page,每个page包含一个editor和view的集合。一个editor主要用于编辑和查看文档或输入对象(input object)。对editor进行变更,接下来就是open-save-close 生命周期模式。一个view主要用于遍历结构化信息、打开一个editor或显示一个激活editor的属性。与editor相比,view的变更立即得到保存。editor和view在page里面的布局是通过perspective来完成的。
在workbench里面包括了许多的描述view功能的标准部件。例如,Navigator view就是用于显示和导航workspace。假如在导航器(Navigate)里选定了一个文件,那么你可以打开一个editor,并显示该文件的内容。一旦editor打开,就可以使用Outline view来显示文档的结构化信息,使用properties view来修改文档的属性。
增加一个新view
向workbench里面添加一个view,只需要简单的三步:
1.创建一个插件;
2.增加一个view extension 到 plugin.xml里面;
3.为这个extension定义一个view类
第一步:创建一个插件
此时,plugin.xml里面的内容为:
<?xml version = "1.0" encode = "UTF-8"?> <?eclipse version ="3.2"?> <plugin></plugin>
第二步:往plugin.xml增加一个view扩展
<?xml version = "1.0" encode = "UTF-8"?> <?eclipse version ="3.2"?> <plugin> <extension point = "org.eclipse.ui.views" name = "Label View" class = "org.eclipse.ui.articles.views.LabelView" icon = "icons\view.gif"/> </plugin>
`其中
id- 唯一标识符用来描述这个view
name - 可以在UI里面显示的名字
class- a fully quified name,这个类implements org.eclipse.ui.IViewPart.一般情况下,都是从org.eclipse.ui.part.ViewPart类继承下来。
icon - 用于这个view的图片的相对路径
第三步:定义该类
package org.eclipse.ui.articles.views; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.ViewPart; public class LabelView extends ViewPart{ private Lable labe; public LabelView(){ super() } public void setFocus(){ label.setFocus(); } public void createPartControl(Composite parent){ lable = new Lable(parent,SWT.NONE); lable.setText("Hello World"); } }
view的生命周期
当一个view被添加到workbench page里面时,其生命周期就开始了。如果用户从Perspective->Show View启动view,则生命周期始于于page创建的过程中,或创建之后。以下任何一步被执行都导致view生命周期的开始:
(1)An instance of the view class is instantiated.
(2)The IViewPart.init method is called to initialize the context for the view. An IViewSite object is passed, and contains methods to get the containing page, window, and other services is passed.
(3)The IViewPart.createPartControl method is called. Within this method the view can create any number of SWT controls within a parent Composite. These provide the presentation for some underlying, view specific model.
当view被关闭时,生命周期也就终止了。
(1)The parent Composite passed to createPartControl is disposed.This children are also implicitly disposed. If you wish to run any code at this time, you must hook the control dispose event.
(2)The IViewPart.dispose method is called to terminate the part liflecycle. This is the last method which the workbench will call on the part. It is an ideal time to release any fonts, image.etc.
为什么不能够通过API来声明View呢?
所有用于workbench里面的views都必须用XML来声明,理由有以下两点:
1.在eclipse里面,一个extension的presence都是用XML来声明的。
2.view的声明也是用于workbench的持久化。当workbench被关闭时,workbench里面的所有的view的ID和position都被存储到文件里,It is possible to save the specific view class. However, the persistence of class names in general is brittle, so view id's are used instead. On startup, the view id is mapped to a view extension within the plugin registry. Then a new instance of the view class is instantiated.
发表评论
-
学习common lisp 一周年
2011-06-13 16:26 898自2010年6月开始学习common lisp。到今天已经整整 ... -
初步介入common lisp殿堂
2010-06-29 08:39 1969“common lisp是一个古老的语言,拥有优雅的语言结构。 ... -
scala2.8 beta终于露出水面了。
2010-01-28 11:02 908scala2.8 已经有了初步成效了。beta版出来,正式版应 ... -
Eclipse在石油行业的表现
2007-12-24 09:01 2050本人就是中国石油工业的一分子,非常热爱计算技术,特别是ecli ... -
基于OSGI的网站
2007-09-13 12:48 2348这近在操刀一个基于osgi的网站,主要用于研究和学习osgi, ... -
Thinking about interface
2007-07-10 14:58 1278前段时间一直在学习osgi 4.1的框架代码,看来看去都是些i ... -
推荐好软件 Adobe Digital Editions
2007-07-10 11:29 1703Adobe Digital Editions,常常阅读PDF文 ... -
Eclipse 3.3 终于要出来了
2007-06-29 10:26 2582eclipse 社区把eclipse的出场搞得那么复杂,感觉好 ... -
关于osgi专栏的一点建议
2007-05-14 21:51 1509最近也在关注osgi&Equinox,没事时读读Equ ... -
公司级应用Eclipse RCP例子
2007-02-28 09:00 4320发现一些公司应用Eclipse RCP的例子,发过来给大家欣赏 ... -
osgi资源
2007-02-27 10:15 2072这几天对osgi很感兴趣,在网上搜了很多资源: osgi-se ... -
Service Oriented programming principles
2006-11-28 09:23 1147Service Oriented programming pr ... -
JFace Tree Viewer
2006-11-17 11:50 1604Big Picture -
Creating an Eclipse View (3)
2006-11-14 23:17 1528Context Menus 首先,了解一下一些背景知识。ecl ... -
Creating an Eclipse View (2)
2006-11-13 00:28 4327下一个例子:The Word View 添加一个view ex ... -
Workbench UI 图
2006-11-08 14:16 1216... -
Rich Clicent Platform包括的组件
2006-11-08 14:02 1251Rich Clicent Platform包括的组件有五大类: ... -
Java API Design Guidelines
2006-11-08 13:01 1096有篇文章讲了作者的思路:Java API Design Gui ... -
XPath 学习:
2006-10-30 14:35 1097XPath is a language for finding ... -
JAVA程序员面试32问,你能回答多少题?
2006-10-10 12:49 1330第一,谈谈final, finally, finali ...
相关推荐
Web Browser (It works as an Eclipse's editor) Image Viewer Tag Palette CSS code completion and outline DTD code completion, outline and validation JavaScript code completion, outline and ...
Anatomy of an Android Project Drawable Resources Building the Project Android Emulator Summary Chapter 5 Main Building Blocks A Real-World Example Activities Intents Services Content Providers ...
Creating an application-scoped database pool 62 Creating a client-scoped pool 64 Editing an existing pool 66 Importing a pool from another application server 67 Creating an XA pool 69 Using a ...
In summary, this graduation thesis focuses on the design and development of an Android sokoban game using the Eclipse SDK and the MVC pattern. It explores the game's background, design principles, ...
Adopting the B/S (Browser/Server) architecture pattern, the system is deployed and tested on the Tomcat application server, creating an integrated project management system suitable for small ...
Creating Your First Android Project in Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Examining the Android-Created Files . . . . . . . . . . . . . . . . . . . . . . . . . . ...
The development tool software selects Eclipse, and the database software chooses MySQL server. The system adopts the B/S mode, focusing on web development, and also requires Tomcat as the WEB server ...
- **Creating an Example Software Project**:指导用户如何创建示例软件项目,这些项目通常包含了一些预定义的功能,方便学习和测试。 #### 十四、新项目向导 - **The New Project Wizard**:新项目向导是创建新...
■CHAPTER 16 From Eclipse RCP to the NetBeans Platform . . . . . . . . . . . . . . . . . . 279 ■CHAPTER 17 Tips and Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
Customizing the View.................................................................................67 Creating the Game Loop............................................................................