Command handler and shotcuts [message #465610] |
Tue, 03 April 2007 07:23 |
Eclipse User |
|
|
|
Originally posted by: valere.fedronic.ext.streamezzo.com
Hi everybody,
The simplest way to explain my question is to show a sample.
A) In my RCP application i declare a global cut action:
/*ActionBarAdvisor#makeActions*/
cutAction = ActionFactory.CUT.create(window);
register(cutAction);
/*ActionBarAdvisor#fillMenuBar*/
....
editMenuManager.add(cutAction);
....
B) In a view part i hook a handler to this global action :
myCut = new MyCutAction();
getViewSite().getActionBars().setGlobalActionHandler(ActionF actory.CUT.getId(),
myCut);
C) Next the myCut action is added to the context menu of the view
menuManager.add(myCut);
D) In the plugin.xml the Ctrl+X key sequence is associated to the cut
command.
And it works fine, when i type Ctrl+X the cut command is executed.
The problem is that the key sequence does not appear in the context menu
right to the action label e.g 'Cut Ctrl+C'.
In the edit menu (containing the global action) the key sequence appears.
How can i fix that?
I have a solution, but i don't know if it's the right way.
In the view context menu, instead of adding the myCut action i do the
following :
menuManager.add(ActionFactory.CUT.create(window));
which creates a new cut global cut action .
valere.
Thanks for the help.
|
|
|
|
Re: Command handler and shotcuts [message #465731 is a reply to message #465722] |
Wed, 04 April 2007 07:42 |
Eclipse User |
|
|
|
Originally posted by: valere.fedronic.ext.streamezzo.com
Thanks for the answer.
> Does MyCutAction return the correct action definition id for the cut
> command?
No, it wasn't, but i change it :
myCut.setActionDefinitionId(ActionFactory.CUT.getId());
And the shortcut sequence is still not displayed.
I noticed that the key bindings are not displayed in the navigator and
marker view context menus but it works in the package view, i'm going to
take a look.
Thx,
valere.
valere.
Paul Webster wrote:
> valere fedronic wrote:
>> B) In a view part i hook a handler to this global action :
>>
>> myCut = new MyCutAction();
>> getViewSite().getActionBars().setGlobalActionHandler(ActionF actory.CUT.getId(),
>> myCut);
>
> Does MyCutAction return the correct action definition id for the cut
> command?
>
> PW
|
|
|
|
|
Re: Command handler and shotcuts [message #465776 is a reply to message #465748] |
Thu, 05 April 2007 07:27 |
Eclipse User |
|
|
|
Originally posted by: valere.fedronic.ext.streamezzo.com
It works!
( with "org.eclipse.ui.edit.cut").
Thanks again,
valere.
Paul Webster wrote:
> Paul Webster wrote:
>>
>> That's the action ID, not the command definition id. the command id
>> looks something like org.eclipse.ui.file.cut
>>
>
> Ooops, org.eclipse.ui.edit.cut
> PW
|
|
|
Powered by
FUDForum. Page generated in 0.03168 seconds