首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

[Eclipse RCP] 1. 一个简略的RCP程序示例

2013-03-27 
[Eclipse RCP] 1. 一个简单的RCP程序示例创建第一个RCP项目New - Plugin Project设置其ID、版本号、名称取消

[Eclipse RCP] 1. 一个简单的RCP程序示例
创建第一个RCP项目

New - Plugin Project

[Eclipse RCP] 1. 一个简略的RCP程序示例


设置其ID、版本号、名称

取消选择Generate an activator

将Rich Client Application区域设为Yes

[Eclipse RCP] 1. 一个简略的RCP程序示例


选择Hello RCP模板

[Eclipse RCP] 1. 一个简略的RCP程序示例


生成的项目结构如下:

[Eclipse RCP] 1. 一个简略的RCP程序示例

运行

自动创建的代码会生成一个空界面,运行结果如图:

[Eclipse RCP] 1. 一个简略的RCP程序示例

代码分析
plugin.xml

Eclipse默认用plugin manifest editor打开plugin.xml,主要有如下几个标签页:

1)Overview

显示项目基本信息,其中Test区域的按钮可快速启动或调试plugin程序。

[Eclipse RCP] 1. 一个简略的RCP程序示例


2)Dependencies

可查看该插件所依赖的其他插件,例如本插件依赖于org.eclipse.core.runtime、org.eclipse.ui;

还可通过Dependency Analysis查看dependency hierarchy。

[Eclipse RCP] 1. 一个简略的RCP程序示例

这部分内容实际是定义在MANIFEST.MF文件中:

这部分内容实际是定义在plugin.xml中的内容:


添加工具栏

1)在WorkbenchWindowAdvisor中显示工具栏


添加状态栏

1)在WorkbenchWindowAdvisor中显示状态栏

    protected void fillTrayItem(IMenuManager trayItem) {trayItem.add(aboutAction);trayItem.add(exitAction);}










热点排行