[Eclipse RCP] 1. 一个简单的RCP程序示例
创建第一个RCP项目
New - Plugin Project
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721308.jpg)
设置其ID、版本号、名称
取消选择Generate an activator
将Rich Client Application区域设为Yes
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721309.jpg)
选择Hello RCP模板
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721310.jpg)
生成的项目结构如下:
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721311.jpg)
自动创建的代码会生成一个空界面,运行结果如图:
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721312.jpg)
plugin.xml
Eclipse默认用plugin manifest editor打开plugin.xml,主要有如下几个标签页:
1)Overview
显示项目基本信息,其中Test区域的按钮可快速启动或调试plugin程序。
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721313.jpg)
2)Dependencies
可查看该插件所依赖的其他插件,例如本插件依赖于org.eclipse.core.runtime、org.eclipse.ui;
还可通过Dependency Analysis查看dependency hierarchy。
![[Eclipse RCP] 1. 一个简略的RCP程序示例](http://img.reader8.net/uploadfile/jiaocheng/20140125/2639/2014012614390721314.jpg)
这部分内容实际是定义在MANIFEST.MF文件中:
这部分内容实际是定义在plugin.xml中的内容:
添加工具栏1)在WorkbenchWindowAdvisor中显示工具栏
添加状态栏1)在WorkbenchWindowAdvisor中显示状态栏
protected void fillTrayItem(IMenuManager trayItem) {trayItem.add(aboutAction);trayItem.add(exitAction);}