Eclipse的RCP键绑定不起作用 [英] eclipse rcp keybindings don't work

查看:138
本文介绍了Eclipse的RCP键绑定不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Eclipse键绑定起作用。
我试图使重命名命令起作用。
我看了一些教程并进行了实验。我在控制台中启用了命令和键绑定跟踪(


I am trying to make eclipse keybindings work. I tried to make the rename command work. I looked at some tutorials and experimented. I enabled command and key binding trace in console (http://eclipsesource.com/blogs/2009/07/08/tip-tracing-keybindings-in-rcp/).

I have created a custom command:

com.mycompany.myproduct.command.rename

This is what I got so far:

1) I tried to follow this tutorial,http://www.vogella.com/tutorials/EclipseCommandsKeybindings/article.html, but I came to the conclusion that this is for e3. This is because you need to add commands plugin that recognize only old e3 handlers. No xmi is involved

2) I tried to use xmi binding contexts. I had my command registered in the top level commands tree and connected to a handler in the top level handlers tree. In the binding tables section I have a bindingTable that works in Dialog and Windows context. I added a key binding. The sequence is "F2" and it is connected to my custom command.

When I hit F2 I get the following message in trace:

COMMANDS >>> execute >>> starting: id=org.eclipse.ui.edit.rename; event=ExecutionEvent(Command(org.eclipse.ui.edit.rename,Rename,
        Rename the selected item,
        Category(org.eclipse.ui.category.file,File,null,true),
        org.eclipse.ui.internal.MakeHandlersGo@1285594,
        ,,true),{},Event {type=1 Tree {} time=1480412218 data=null x=0 y=0 width=0 height=0 detail=0},org.eclipse.e4.ui.workbench.modeling.ExpressionContext@177fc1a)

In short the default eclipse IDE rename command is fired (my key binding does nothing), and nothing happens on my application.

However, if I change the sequece to "M1+1" and hit ctrl + 1, a little pop up comes up that lets me choose between "quick fix" (eclipse IDE command) and my rename. If I choose rename the handler fires.

Now, how do I disable eclipse IDE default keybindings. The instructions of the tutorial in step 1 definitely don't do it.

Thanks!

解决方案

You can try to force E4 to read your key binding as an user one, adding the "type:user" tag to the KeyBinding itself :

这篇关于Eclipse的RCP键绑定不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆