具有键盘快捷键的SWT操作...无需将其添加到菜单 [英] SWT Actions with Keyboard Shortcuts... without having to add them to the menu
本文介绍了具有键盘快捷键的SWT操作...无需将其添加到菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们目前已经实现了许多SWT操作,因为这是一种绑定单个命令的好方法,该命令将添加到菜单栏和工具栏,并为这些命令提供快捷键.
We currently have implemented a lot of SWT Actions, because it is a nice way to bind a single command to be added to the menubars and toolbars, and to have Keyboard Shortcuts for these commands.
现在...我该如何在普通的SWT/JFace中注册一个动作,而不必将其添加到菜单栏中,但是仍然可以通过键盘快捷键来调用它?
Now... how can I register an Action in plain SWT/JFace without having to add it to a menubar, but in a way that it still can be called by a keyboard shortcut?
推荐答案
我通常通过在KeyDown
事件上使用Display.addFilter
在普通SWT中解决此问题.有关示例,请参见此问题.
I use to solve this in plain SWT by using Display.addFilter
on the KeyDown
event. See this question for an example.
这篇关于具有键盘快捷键的SWT操作...无需将其添加到菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文