Accelerator key to the Action [message #467613] |
Wed, 09 May 2007 01:40  |
Eclipse User |
|
|
|
Hi,
I have defined ExitAction and added to the view's menubar and
toolbar and context menu...
But the accelerator key is not display and also not working..
public ExitAction()
{
this.setText("E&xit\tCtrl+X");
this.setToolTipText("Exit the main window");
this.setAccelerator(SWT.CTRL+'X');
}
Why the Accelerator key is not working
Thanks in advance,
Swetha
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Accelerator key to the Action [message #467822 is a reply to message #467738] |
Fri, 11 May 2007 00:33  |
Eclipse User |
|
|
|
Hi,
I am confused.. I want to tell u once again what I am doing ..
In pulg-in.xml,
<extension
point="org.eclipse.ui.commands">
<category
description="Actions take at lunch time."
id="view.keybindings.category"
name="EndUser">
</category>
<command
categoryId="view.keybindings.category"
defaultHandler="org.eclipse.ui.handlers.IHandlerActivation"
description="Exit from the view"
id="view.keybindings.exit"
name="Exit">
</command>
<keyBinding
commandId="view.keybindings.exit"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration "
keySequence="Ctrl+3"/>
</extension>
And in the View Class,
in createPartControl() method,
IHandlerService handlerService = (IHandlerService)
window.getService(IHandlerService.class);
handlerService.activateHandler("view.keybindings.exit", new
ActionHandler(exitAction));
getSite().getService(IHandlerService.class);
And in the ExitAction Class,
public ExitAction()
{
this.setText("E&xit@Ctrl+3");
this.setToolTipText("Exit the main window");
this.setId("EXIT");
this.setActionDefinitionId("view.keybindings.exit");
}
This is working only for the first time the view is displayed.. If I close
it and open it again from the ShowView menu, its not working,... sorry for
irritating u all... Please tell me what I am doing wrong here
Thanks,
Swetha
|
|
|
Powered by
FUDForum. Page generated in 0.11696 seconds