Rcp学习总结

1、一个plugin中只有一个application

2、rcp4中的application不用自己写类实现,已经包含在application。xmi文件中

3、rcp3创建的项目在rcp4中可以接着开发。

4、perpective添加view不显示

如果在开发中发现,没有打包发布之前,如论运行application或product方式,如果setSaveAndRestore设置为true那么只能看到welcome视图而不能看见我所创建的view,
但是setSaveAndRestore将setSaveAndRestore改成false就可以了,所以笔者建议:在开发的时候将参数指定为false, 到发布的时候改成true.

5、在run configureation中配置clear缓存,不然更改没有效果

6、Rcp添加菜单和工具栏:

 通过command添加菜单和工具栏(action的不利于分离已经out) http://www.itkeyword.com/doc/0732274388348506x155
还可以通过代码进行加载,设置ApplicationActionBar类进行设置。通过代码显示action没有效果的话,需要检查ApplicationWindowWorkbenchAdvisor里面的
createActionBar方法返回的是不是自己设计的类。

7、rcp3中没有在application.xmi文件需要自己实例化appclition这个类来进行初始化操作。因此part也需要在extension中添加views的拓展。类事项ViewPart这个父类来完成view的显示。

8、Rcp在打包时出现

In plugin com.example.wotrd.hyperbola, the value for property source.@dot is not set.
这个错误,首先检查build.properties,看是不是有没有加载的,将source.. = 使用 source.. = src/替换

9、打开打包完的项目,首先会弹出控制台,

将打包完项目的ini文件打开,将-consoleLog删除,重新打开就好了。

10、新定义的properties文件找不到:

在META-INFO的Manifest.mf文件中添加:    Bundle-Localization: plugin

11、JAVAClean project之后报错:java.lang.RuntimeException: No application id has been found.

https://www.cnblogs.com/chenyongblog/p/4981549.html

12、给rcp的导航的某个节点使用command添加节点,只在本节点上。右键上下文菜单。 参考链接:http://blog.csdn.net/soszou/a...
在plugin。xml文件中,添加command,然后,添加handler,handler也控制菜单的显示情况。
可以使用instanceof和adapt来控制显示情况。还有and和or等判断条件
例如:

<command
commandId="org.eclipse.ui.edit.indexrebuild"
label="%command.org.eclipse.ui.edit.indexrebuild.name">
<visibleWhen checkEnabled="true"/>
</command>
command包含在<menuContribution allPopups="false" locationURI="popup:org.eclipse.ui.popup.any?after=navigator_additions">

<handler commandId="org.eclipse.ui.edit.indexrebuild" class="org.jkiss.dbeaver.ui.actions.navigator.NavigatorHandlerObjectDelete">

<enabledWhen>
   <with variable="selection">
      <count value="1"/>
      <iterate operator="and">
        <and>
            <instanceof value="org.jkiss.dbeaver.model.navigator.DBNNode"/>
            <adapt type="org.jkiss.dbeaver.model.struct.rdb.DBSTableIndex"/>
        </and>
      </iterate>
   </with>
</enabledWhen>

</handler>
重点:使用adapt需要声明:

如下:
<extension point="org.eclipse.core.runtime.adapters">
    <factory adaptableType="org.jkiss.dbeaver.model.DBPObject" class="org.jkiss.dbeaver.ui.navigator.NavigatorAdapterFactory">
        <adapter type="org.jkiss.dbeaver.model.DBSTableIndex"/>


13、添加对话框,使用resourceundle的字符串。参考deletehandler的部分使用方法:

DBeaverActivator.getCoreResourceBundle().getString(ConfirmationDialog.RES_CONFIRM_PREFIX + objectType + "_" + ConfirmationDialog.RES_KEY_TITLE);
使用前缀-中间-后缀进行拼凑。组成一个字符串也就是key从CoreResources.properties文件中进行获取。
步骤:
    1.在CoreResources.properties文件中定义参数:定义的时候需要根据ConfirmDialog的拼凑格式起名字。
         confirm_index_rebuild_title = Index Rebuild
            confirm_index_rebuild_message = Will you rebuild the index, ok?
    2.在DBeaverPreferences文件中添加常量indexrebuild,使用DBeaverActivator.xxx就可以进行获取。
    3.解决中英文国际化问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值