9. 练习:将Eclipse plug-in转化成Eclipse 4 Application project
2016-09-11 12:08
375 查看
1. 目标
将上一篇创建的一个简单的Eclipse plug-in project转化成一个Eclipse 4 Application Project。2. 创建一个project 来持有product configuration file
创建一个名称为com.example.e4.rcp.to.product 的project ,File –> New – > Others …– >General – > Project。3. 创建product configuration 文件
右键该工程,选择New –> Product Confiuration在com.example.e4.rcp.todo.product 目录下创建product configuration file称作todo.product
点击finish按钮,该文件将会创建并在编辑器中打开,在Overview的选项卡中 ,点击New 按钮,
输入to-do作为Product Name, 选择上一节中创建的plug-in作为Defining Plug-in , product作为ID, 同时在Application的下拉菜单中 ,选择 org.eclipse.e4.ui.workbench.swt.E4Application 。
4. 配置启动级别
切换到configuration 的选项卡中,点击Add Recommended按钮。这些设置就像是使用Maven或者Tycho构建系统,因此,推荐使用这种方式进行配置。5. 创建feature project
创建名为 com.example.e4.rcp.todo.feature : File–>New –> Other … –> Plug-in Development –> Feature Project. 点击finish完成创建。打开feature.xml 并选择plug-in tab , 点击add按钮,将com.example.e4.rcp.todo plug-in包含进来
注意:尤其要注意这里使用的是included plug-in tab, 而不是dependencies tab
6. 将feature作为产品的contents
打开todo.product文件,改变product configuration 使用feature.打开contents tab,通过add按钮添加如下features
* org.example.e4.rcp.todo.feature * org.eclipse.e4.rcp * org.eclipse.emf.ecore * org.eclipse.emf.common
7. 在product中,从feature上移除version依赖
为了避免org.eclipse.e4.rcp feature不同的版本带来的问题,在product中删除版本号。通过Properties –>若别的features也有版本依赖,同样去移除他们。
8. 创建一个application model
File –> New –> Other… –> Eclipse 4 – > Model –> New Application Model输入com.example.e4.rcp.todo 作为Container ,同时使用默认的文件名称。
点击finish,将在com.example.e4.rcp.todo 中打开。
9. 在application model中添加window
在application model中添加window, 这样就有了一个可视化的控件。右键Window and Dialogs 选择Trimed Window
输入ID,
Tip : 当关闭应用之后,在关闭之前的最后的状态将会被framework持久化,下一次程序启动将会恢复上一次最后的状态。
10. 启动application
打开Product 文件,选择Overview tab 选择Launch an Eclipse application至此,将会出现一个空的window, 可以移动,最大最小,关闭,可以改变大小。
11. 在启动时删除已保存的用户改变
为了保证最新版本的application model 被使用,在product configuration 添加-clearPersistedState 参数.当启动程序的时候,eclipse会按照上次关闭时的状态打开应用程序。在开发时,这种模式可能会导致对程序的改变无法应用,比如,你定义了一个menu,但是menu没有按照预期展示出来。
当然,上面提到的我们也是有解决办法的,可以在RUN configuration Main 选项卡中选中clear按钮.这样在程序启动的时候就会将一些持久化的数据删除。
相关文章推荐
- 8. 练习:创建一个Eclipse plug-in项目
- Fat Jar Eclipse Plug-In教程
- Maven2 for eclipse plug-in
- Eclipse+ GNU ARM Eclipse Plug-in+ Sourcery G++ Lite Edition for ARM+OPENCD+Jlink
- GNU ARM Eclipse Plug-in 0.5.4 for Eclipse 3.7 Indigo
- Eclipse安装 Team Explorer Everywhere TFS Plug-in
- eclipse plug-in编译小结
- [Eclipse plug-in] org.eclipse.ui.perspectives扩展点
- Eclipse+ GNU ARM Eclipse Plug-in+ Sourcery G++ Lite Edition for ARM+OPENCD+Jlink的开源开发环境。
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.jdt.internal.ui.packageview.P
- JES email server launcher Eclipse plug-in
- 更新ADT遇到问题,requires plug-in "org.eclipse.wst.sse.ui"
- Integrating with Eclipse: The Subclipse Plug-in
- 如何安装Eclipse插件(Plug-in) Visual Editor
- 错误记录--安装Flex Builder 3 Plug-in到eclipse出现的错误
- 2007-8-3 Eclipse plug-in
- ADT 安装过程中的错误: "requires plug-in org.eclipse.wst.sse.ui".
- Eclipse平台Plug-in(插件)开发中对于perspectives的使用和设置
- Eclipse启动失败 - 在安装BlackBerry Java Plug-in for Eclipse v1.3之后
- Eclipse jQuery plug-in(自动补全)