Eclipse Editor插件键绑定未显示在菜单中用于命令 [英] Eclipse Editor plug-in key binding not shown in menu for command
问题描述
我有一个键绑定,在我的自定义Eclipse编辑器插件中触发一个命令:
< key
commandId =my.plugin.ui.MyCommand
contextId =my.plugin.ui.mycontext
schemeId =org.eclipse.ui.defaultAcceleratorConfiguration
sequence = M1 + M2 + O>
< / key>
我正在使用一个新定义的上下文 mycontext
以便能够覆盖已经存在的用于组织导入的密钥绑定。 mycontext
是 org.eclipse.ui.contexts.window
的子上下文
为此命令创建菜单条目时,键盘快捷方式不会显示在标签旁边,因为绑定的上下文不是 org.eclipse.ui.contexts.window
但它的孩子。
当右键单击 .java
整理导入 __ _ __ _ __ _ ___ Ctrl + Shift + O
<有没有办法显示自定义上下文的绑定?
您是否尝试激活视图的创建零件控件中的上下文方法。
PlatformUI.getWorkbench()。getDisplay()。asyncExec(new Runnable(){
@Override
public void run(){
PlatformUI.getWorkbench()。getServic E(IContextService.class).activateContext( custom.context.id);
}
});
I have a key binding that triggers a command in my custom Eclipse editor plug-in:
<key
commandId="my.plugin.ui.MyCommand"
contextId="my.plugin.ui.mycontext"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+O">
</key>
I am using a newly defined context mycontext
to be able to overwrite the already existing key binding for organizing imports. mycontext
is a child context of org.eclipse.ui.contexts.window
.
When creating a menu entry for this command, the keyboard shortcut is not shown next to the label because the context for the binding is not org.eclipse.ui.contexts.window
but its child.
The desired presentation would look like that of the default binding when right-clicking .java
files:
Organize Imports ____________ Ctrl+Shift+O
Is there a way to show the bindings for custom contexts?
Did you try to activate the context in the view's create part control method.
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
PlatformUI.getWorkbench().getService(IContextService.class).activateContext("custom.context.id");
}
});
这篇关于Eclipse Editor插件键绑定未显示在菜单中用于命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!