Eclipse 3.6 RCP入门指南:创建应用与功能详解

需积分: 10 12 下载量 5 浏览量 更新于2023-06-23 收藏 3.32MB PDF 举报
本篇教程详细介绍了如何使用Eclipse 3.6 Rich Client Platform (RCP) 进行应用程序开发。Eclipse RCP是一种强大的框架,它利用Eclipse的架构风格,使得开发者能够构建高度可扩展和灵活的桌面应用,同时能够重用Eclipse生态系统中的现有组件和编程模式。作者强调了RCP入门的挑战性,但每个章节内容独立,便于学习者逐步掌握。 教程首先涵盖了RCP的基础概念,包括Eclipse RCP的构建风格,即插件、扩展和扩展点,以及RCP与插件的区别。接着,作者指导读者如何创建第一个RCP程序,从设置项目、启动程序,到理解程序与产品的区别,以及如何管理和配置launch配置。 在后续章节中,作者深入探讨了actions的使用,如菜单栏和工具栏的创建,不仅提供编码方式添加,还包括扩展方式和全局快捷键的绑定。系统托盘功能也得到了讲解,这对于实现后台运行和通知非常重要。此外,视图的管理是RCP开发的核心部分,包括添加示例视图、自定义视图以及在视图中添加action,这些都是构建用户界面的关键环节。 对于编辑器,虽然部分内容未在提供的摘录中给出,可以推测这部分会讲解如何集成和定制Eclipse编辑器组件,以便实现文本编辑、代码编辑等功能。 整个教程旨在为Eclipse开发者提供一个全面的学习路径,无论是初次接触RCP还是希望进一步提升技能的开发者,都能从中找到适合自己的内容。作者还鼓励读者访问<http://www.xeclipse.com>获取更多资源和支持,并提供了联系邮箱<salever@126.com>以解答疑问或获取额外帮助。这是一份实用且系统的自学教程,适合在Eclipse 3.6 RCP开发过程中参考。
2011-02-17 上传
【CSDN首发】,百度上的不是完整版本,非本人发布 本教程素材来源于网络,经过本人的整理、添加以及部分的重写,将原有的Eclipse3.3版本的一些内容完全迁移到Eclipse3.6版本上来。基于开源以及分享的精神,特地将教程分享到网络上,希望所有需要的朋友因此而受益,也希望大家能有版本意识,转载时注明来自salever@126.com。 之前有一套基于Eclipse3.3版本的教程,也是本人整理,由于本人的疏忽,导致网络上的版本各不相同,但分享已久,无法改变,希望大家谅解并使用新版本的教程。 本教程由本人发布在www.ceclipse.org以及本人的blog中,希望对大家有所帮助,也希望各位喜欢分享的朋友在转载时注明,谢谢。 手头有一些不错的Eclipse资料,只可惜它用的Eclipse还是3.3版本的,很多东西都已经无法使用。最近抽些时间,更新到eclipse3.6上来,既作为为广大Eclipser入门plugin/RCP开发的一个方便之门,也是对自己近年来学习的一个总结吧。 每一章都会单独提取出来,并尽可能的独立于其他章节,更新中的源代码工程也会附加在附件里面下载。 等到所有的章节都弄完以后,再统一发一个完整版本。 特点: 1,基于Eclipse 3.6.0 2,所有代码均可直接复制运行 3,简单、全面,合适初学者入手 目录 1 富客户端平台 .....................................................................................................................................9 1.1 概述 ..............................................................................................................................................9 1.2 ECLIPSE RCP 建设风格——插件,扩展和扩展点 .....................................................................9 1.3 RCP与PLUGIN ...............................................................................................................................9 2 创建第一个RCP程序 ........................................................................................................................11 2.1 创建一个RCP程序 ......................................................................................................................11 2.2 启动RCP程序 ..............................................................................................................................15 2.3 程序VS 产品 ..............................................................................................................................17 2.4 维护LAUNCH配置 .......................................................................................................................17 2.5 可能的APPLICATION ID 错误: ..................................................................................................20 2.6 应用程序的PLUGIN ID ................................................................................................................21 3 ACTIONS的用法(菜单栏和工具栏) ............................................................................................22 3.1 概述 ............................................................................................................................................22 3.2 通过编码添加 .............................................................................................................................22 3.3 “扩展”方式添加菜单和工具栏 ..................................................................................................25 3.4 添加全局快捷键 .........................................................................................................................31 3.4.1 Command+Handler+Binding 绑定 ......................................................................................31 3.4.2 Action+Command+Binding绑定 ..........................................................................................33 4 系统托盘 ...........................................................................................................................................37 5 视图 ...................................................................................................................................................42 5.1 添加示例视图 .............................................................................................................................42 5.2 添加自定义视图 .........................................................................................................................47 5.3 向VIEW里添加ACTION ................................................................................................................52 RCP/Plug-in 开发自学教程 salever@126.com - 4 - 6 编辑器 ...............................................................................................................................................58 6.1 概述 ............................................................................................................................................58 6.2 创建工程 ....................................................................................................................................58 6.3 添加编辑器 ................................................................................................................................59 6.4 调用编辑器 ................................................................................................................................67 6.5 实例:文本编辑器实现 .............................................................................................................68 6.5.1 新建工程 ..............................................................................................................................68 6.5.2 添加菜单栏和工具栏 ..........................................................................................................70 6.5.3 添加编辑器 ..........................................................................................................................75 7 对话框 ...............................................................................................................................................86 7.1 概述 ............................................................................................................................................86 7.2 预定义的对话框 .........................................................................................................................87 7.2.1 概述 .....................................................................................................................................87 7.2.2 创建工程 ..............................................................................................................................87 7.2.3 添加菜单 ..............................................................................................................................87 7.2.4 调用对话框 ..........................................................................................................................87 7.3 用户自定义对话框 .....................................................................................................................89 7.3.1 概述 .....................................................................................................................................89 7.3.2 创建SWT/JFace工程 ...........................................................................................................89 7.3.3 自定义Dialog .......................................................................................................................91 7.3.4 说明 .....................................................................................................................................97 8 向导 ...................................................................................................................................................98 8.1 概述 ............................................................................................................................................98 8.2 示例 ............................................................................................................................................98 9 首选项 .............................................................................................................................................106 RCP/Plug-in 开发自学教程 salever@126.com - 5 - 9.1 首选项 ......................................................................................................................................106 9.2 使用首选项 ...............................................................................................................................106 9.3 首选项页 ..................................................................................................................................112 10 添加状态栏 ...................................................................................................................................117 10.1 简介 ........................................................................................................................................117 10.2 安装状态栏 .............................................................................................................................117 10.3 初始化状态条 .........................................................................................................................118 10.4 控制状态栏 .............................................................................................................................120 11 透视图 ...........................................................................................................................................123 11.1 简介 ........................................................................................................................................123 11.2 添加透视图 .............................................................................................................................123 11.3 显示透视图工具栏 .................................................................................................................128 11.4 显示透视图菜单 .....................................................................................................................130 12 进度条 ...........................................................................................................................................133 12.1 简介 ........................................................................................................................................133 12.2 进度条对话框 .........................................................................................................................133 12.3 JOB进度条 ...............................................................................................................................135 13 使用第三方JAR .............................................................................................................................140 13.1 概述 ........................................................................................................................................140 13.2 向构建路径中添加JAR ...........................................................................................................140 13.3 使JAR在你的运行路径里有效 ................................................................................................141 14 提示和策略 ...................................................................................................................................143 14.1 控制台日志 .............................................................................................................................143 14.2 保存用户的布局 .....................................................................................................................145 RCP/Plug-in 开发自学教程 salever@126.com - 6 - 14.3 获得DISPLAY ............................................................................................................................146 14.4 使用ECLIPSE的“保存”ACTION .................................................................................................146 14.5 向你的程序添加错误日志视图 .............................................................................................146 15 产品 ...............................................................................................................................................149 15.1 概述 ........................................................................................................................................149 15.2 PRODUCT配置文件 ...................................................................................................................149 15.3 测试你的产品 .........................................................................................................................153 15.4 欢迎页面 ................................................................................................................................153 15.5 商标 ........................................................................................................................................154 15.6 风格化LAUNCHING ..................................................................................................................155 15.7 发布你的产品 .........................................................................................................................156 15.8 创建一个帮助插件工程 .........................................................................................................159 16 专题一 ECLIPSE的版本和发行包 ..............................................................................................164 16.1 版本 VERSION .........................................................................................................................164 16.1.1 版本的理解 ......................................................................................................................164 16.1.2 Eclipse的版本 ...................................................................................................................164 16.1.3 版本的选择和下载 ..........................................................................................................164 16.2 发行包 EDITION ......................................................................................................................166 16.2.1 发行包的理解 ..................................................................................................................166 16.2.2 Eclipse的发行包 ...............................................................................................................166 17 专题二 ECLIPSE的国际化与语言包 ..........................................................................................169 17.1 国际化 ....................................................................................................................................169 17.1.1 Externalize Strings ............................................................................................................169 17.1.2 中文属性文件 ..................................................................................................................175 17.1.3 国际化文件 ......................................................................................................................176 17.1.4 指定语言环境 ..................................................................................................................176 RCP/Plug-in 开发自学教程 salever@126.com - 7 - 17.1.5 Propedit工具 .....................................................................................................................177 17.2 语言包 ....................................................................................................................................177 17.2.1 Babel小组 .........................................................................................................................177 17.2.2 中文语言包的下载 ..........................................................................................................178 18 专题三 DECORATOR与MARKER的使用 .................................................................................180 18.1 简介 ........................................................................................................................................180 18.2 扩展DECORATOR ......................................................................................................................180 18.3 扩展MARKER ...........................................................................................................................184 19 专题四 RUN/DEBUG LAUNCHER实现 ....................................................................................190 19.1 ECLIPSE RUN/DEBUG 实现流程 ...............................................................................................190 19.2 扩展CONFIGURATIONTYPE .......................................................................................................192 19.3 扩展ILAUNCHSHORTCUT .........................................................................................................194 19.4 创建RUN/DEBUG CONFIGURATION界面 ..................................................................................197 19.5 指定RUN/DEBUG显示图片 .....................................................................................................204 19.6 说明 ........................................................................................................................................205 20 专题五 EQUINOX P2 方式实现RCP自动更新 .........................................................................207 20.1 概述 ........................................................................................................................................207 20.2 示例 ........................................................................................................................................207 20.2.1 Feature概念 .......................................................................................................................207 20.2.2 配置Product .....................................................................................................................210 20.2.3 配置Feature ......................................................................................................................211 20.2.4 product导出 ......................................................................................................................213 20.2.5 配置Equinox P2 ...............................................................................................................214 20.2.6 配置 Update Site .............................................................................................................215 21 专题六 COMMON NAVIGATOR FRAMEWORK初探 .............................................................216