Key binding and selection in viewer [message #685299] |
Fri, 17 June 2011 08:30 |
Martin W Messages: 7 Registered: July 2009 |
Junior Member |
|
|
I have a command which I use in a popup menu in a tree viewer and I want to reuse for key binding:
<command commandId="my.command.delete" label="Delete">
<visibleWhen>
<reference definitionId="my.expression.delete"></reference>
</visibleWhen>
</command>
<definition id="my.expression.delete">
<with variable="activeMenuSelection">
<iterate ifEmpty="false" operator="and">
<or>
<instanceof value="model.IOne"></instanceof>
<instanceof value="model.ITwo"></instanceof>
</or>
</iterate>
</with>
</definition>
This command is only visible if the specified objects are selected. Now I want to support deleting these objects also by the DEL key. So I have add a new key binding;
<key commandId="my.delete" contextId="my.navigationView" schemeId="my.scheme" sequence="DEL"></key>
But I have two problems: How can I reuse my delete expression for my key binding? Of course 'activeMenuSelection' doesn't work in this case. But how can I test which objects are selected? In my DeleteHandler I call 'HandlerUtil.getActiveMenuSelection(event)' to get the selection. How can I get the selection independent of the call by popup menu or by DEL key.
I understand that eclipse doesn't know that the context of my key binding is only activated if the tree viewer of my navigation view has the focus. My key binding should be only active if the command is visible in the popup menu.
[Updated on: Fri, 17 June 2011 09:14] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03460 seconds