Key Bindings for Actions does [message #482330] |
Wed, 26 August 2009 09:48 |
|
Hello!
I tried to associate a key binding to an action in my RCP application. I
followed the steps on the following two sites:
But what should I say, it simply doesn't work. I know that this
statement isn't very helpful, but i have absolutely no idea what the
problem might be.
So i tried to add such an key bound action to a brand new Sample RCP
(The one with a single View). I used the standard "about" action for
convenience, added it to the main menu and created a key binding. With
the same result: The Action is shown in the Menu and can be clicked, but
when i press the associated keys, nothing happens.
The code i changed from the standard template can be found below... Does
anybody have an idea?
Thanks, Ralf
PS: I use Eclipse 3.5 on Ubuntu Linux 9.04
#### ApplicationActionBarAdvisor ####
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
private IWorkbenchAction exitAction;
private IWorkbenchAction aboutAction;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(final IWorkbenchWindow window) {
aboutAction = ActionFactory.ABOUT.create(window);
aboutAction.setActionDefinitionId("aboutCommand");
register(aboutAction);
exitAction = ActionFactory.QUIT.create(window);
register(exitAction);
}
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("&File",
IWorkbenchActionConstants.M_FILE);
menuBar.add(fileMenu);
fileMenu.add(aboutAction);
fileMenu.add(exitAction);
}
}
### plugin.xml ###
<extension
point="org.eclipse.ui.commands">
<command
id="aboutCommand"
name="About">
</command>
</extension>
<extension
id="custom-bindings"
point="org.eclipse.ui.bindings">
<key
commandId="aboutCommand"
contextId="org.eclipse.ui.contexts.dialogAndWindow"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M2+M3+J">
</key>
</extension>
|
|
|
Re: Key Bindings for Actions does [message #482331 is a reply to message #482330] |
Wed, 26 August 2009 09:50 |
|
oh, I forgot to insert the two links to the faq... sorry.
http://wiki.eclipse.org/FAQ_How_do_I_make_key_bindings_work_ in_an_RCP_application%3F
http://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shor tcut_for_my_action%3F
Ralf Grossklaus wrote:
> Hello!
>
> I tried to associate a key binding to an action in my RCP application. I
> followed the steps on the following two sites:
>
> But what should I say, it simply doesn't work. I know that this
> statement isn't very helpful, but i have absolutely no idea what the
> problem might be.
>
> So i tried to add such an key bound action to a brand new Sample RCP
> (The one with a single View). I used the standard "about" action for
> convenience, added it to the main menu and created a key binding. With
> the same result: The Action is shown in the Menu and can be clicked, but
> when i press the associated keys, nothing happens.
>
> The code i changed from the standard template can be found below... Does
> anybody have an idea?
>
> Thanks, Ralf
>
> PS: I use Eclipse 3.5 on Ubuntu Linux 9.04
>
> #### ApplicationActionBarAdvisor ####
>
> public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
>
> private IWorkbenchAction exitAction;
> private IWorkbenchAction aboutAction;
>
> public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
> super(configurer);
> }
>
> protected void makeActions(final IWorkbenchWindow window) {
>
> aboutAction = ActionFactory.ABOUT.create(window);
> aboutAction.setActionDefinitionId("aboutCommand");
> register(aboutAction);
> exitAction = ActionFactory.QUIT.create(window);
> register(exitAction);
> }
>
> protected void fillMenuBar(IMenuManager menuBar) {
> MenuManager fileMenu = new MenuManager("&File",
> IWorkbenchActionConstants.M_FILE);
> menuBar.add(fileMenu);
> fileMenu.add(aboutAction);
> fileMenu.add(exitAction);
> }
>
> }
>
>
> ### plugin.xml ###
> <extension
> point="org.eclipse.ui.commands">
> <command
> id="aboutCommand"
> name="About">
> </command>
> </extension>
> <extension
> id="custom-bindings"
> point="org.eclipse.ui.bindings">
> <key
> commandId="aboutCommand"
> contextId="org.eclipse.ui.contexts.dialogAndWindow"
> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
> sequence="M2+M3+J">
> </key>
> </extension>
|
|
|
Re: Key Bindings for Actions does [message #482497 is a reply to message #482330] |
Wed, 26 August 2009 19:49 |
|
Hi Ralf,
I know this is not directly related to your question but I suggest to
use commands instead of actions. They are much more powerful then actions.
The usage of commands is described including an example with a working
keybinding.
http://www.vogella.de/articles/EclipseCommands/article.html
Best regards, Lars
--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter
Ralf Grossklaus wrote:
> Hello!
>
> I tried to associate a key binding to an action in my RCP application. I
> followed the steps on the following two sites:
>
> But what should I say, it simply doesn't work. I know that this
> statement isn't very helpful, but i have absolutely no idea what the
> problem might be.
>
> So i tried to add such an key bound action to a brand new Sample RCP
> (The one with a single View). I used the standard "about" action for
> convenience, added it to the main menu and created a key binding. With
> the same result: The Action is shown in the Menu and can be clicked, but
> when i press the associated keys, nothing happens.
>
> The code i changed from the standard template can be found below... Does
> anybody have an idea?
>
> Thanks, Ralf
>
> PS: I use Eclipse 3.5 on Ubuntu Linux 9.04
>
> #### ApplicationActionBarAdvisor ####
>
> public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
>
> private IWorkbenchAction exitAction;
> private IWorkbenchAction aboutAction;
>
> public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
> super(configurer);
> }
>
> protected void makeActions(final IWorkbenchWindow window) {
>
> aboutAction = ActionFactory.ABOUT.create(window);
> aboutAction.setActionDefinitionId("aboutCommand");
> register(aboutAction);
> exitAction = ActionFactory.QUIT.create(window);
> register(exitAction);
> }
>
> protected void fillMenuBar(IMenuManager menuBar) {
> MenuManager fileMenu = new MenuManager("&File",
> IWorkbenchActionConstants.M_FILE);
> menuBar.add(fileMenu);
> fileMenu.add(aboutAction);
> fileMenu.add(exitAction);
> }
>
> }
>
>
> ### plugin.xml ###
> <extension
> point="org.eclipse.ui.commands">
> <command
> id="aboutCommand"
> name="About">
> </command>
> </extension>
> <extension
> id="custom-bindings"
> point="org.eclipse.ui.bindings">
> <key
> commandId="aboutCommand"
> contextId="org.eclipse.ui.contexts.dialogAndWindow"
> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
> sequence="M2+M3+J">
> </key>
> </extension>
|
|
|
|
Re: Key Bindings for Actions does [message #600968 is a reply to message #482330] |
Wed, 26 August 2009 09:50 |
|
oh, I forgot to insert the two links to the faq... sorry.
http://wiki.eclipse.org/FAQ_How_do_I_make_key_bindings_work_ in_an_RCP_application%3F
http://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shor tcut_for_my_action%3F
Ralf Grossklaus wrote:
> Hello!
>
> I tried to associate a key binding to an action in my RCP application. I
> followed the steps on the following two sites:
>
> But what should I say, it simply doesn't work. I know that this
> statement isn't very helpful, but i have absolutely no idea what the
> problem might be.
>
> So i tried to add such an key bound action to a brand new Sample RCP
> (The one with a single View). I used the standard "about" action for
> convenience, added it to the main menu and created a key binding. With
> the same result: The Action is shown in the Menu and can be clicked, but
> when i press the associated keys, nothing happens.
>
> The code i changed from the standard template can be found below... Does
> anybody have an idea?
>
> Thanks, Ralf
>
> PS: I use Eclipse 3.5 on Ubuntu Linux 9.04
>
> #### ApplicationActionBarAdvisor ####
>
> public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
>
> private IWorkbenchAction exitAction;
> private IWorkbenchAction aboutAction;
>
> public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
> super(configurer);
> }
>
> protected void makeActions(final IWorkbenchWindow window) {
>
> aboutAction = ActionFactory.ABOUT.create(window);
> aboutAction.setActionDefinitionId("aboutCommand");
> register(aboutAction);
> exitAction = ActionFactory.QUIT.create(window);
> register(exitAction);
> }
>
> protected void fillMenuBar(IMenuManager menuBar) {
> MenuManager fileMenu = new MenuManager("&File",
> IWorkbenchActionConstants.M_FILE);
> menuBar.add(fileMenu);
> fileMenu.add(aboutAction);
> fileMenu.add(exitAction);
> }
>
> }
>
>
> ### plugin.xml ###
> <extension
> point="org.eclipse.ui.commands">
> <command
> id="aboutCommand"
> name="About">
> </command>
> </extension>
> <extension
> id="custom-bindings"
> point="org.eclipse.ui.bindings">
> <key
> commandId="aboutCommand"
> contextId="org.eclipse.ui.contexts.dialogAndWindow"
> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
> sequence="M2+M3+J">
> </key>
> </extension>
|
|
|
Re: Key Bindings for Actions does [message #600977 is a reply to message #482330] |
Wed, 26 August 2009 19:49 |
|
Hi Ralf,
I know this is not directly related to your question but I suggest to
use commands instead of actions. They are much more powerful then actions.
The usage of commands is described including an example with a working
keybinding.
http://www.vogella.de/articles/EclipseCommands/article.html
Best regards, Lars
--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter
Ralf Grossklaus wrote:
> Hello!
>
> I tried to associate a key binding to an action in my RCP application. I
> followed the steps on the following two sites:
>
> But what should I say, it simply doesn't work. I know that this
> statement isn't very helpful, but i have absolutely no idea what the
> problem might be.
>
> So i tried to add such an key bound action to a brand new Sample RCP
> (The one with a single View). I used the standard "about" action for
> convenience, added it to the main menu and created a key binding. With
> the same result: The Action is shown in the Menu and can be clicked, but
> when i press the associated keys, nothing happens.
>
> The code i changed from the standard template can be found below... Does
> anybody have an idea?
>
> Thanks, Ralf
>
> PS: I use Eclipse 3.5 on Ubuntu Linux 9.04
>
> #### ApplicationActionBarAdvisor ####
>
> public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
>
> private IWorkbenchAction exitAction;
> private IWorkbenchAction aboutAction;
>
> public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
> super(configurer);
> }
>
> protected void makeActions(final IWorkbenchWindow window) {
>
> aboutAction = ActionFactory.ABOUT.create(window);
> aboutAction.setActionDefinitionId("aboutCommand");
> register(aboutAction);
> exitAction = ActionFactory.QUIT.create(window);
> register(exitAction);
> }
>
> protected void fillMenuBar(IMenuManager menuBar) {
> MenuManager fileMenu = new MenuManager("&File",
> IWorkbenchActionConstants.M_FILE);
> menuBar.add(fileMenu);
> fileMenu.add(aboutAction);
> fileMenu.add(exitAction);
> }
>
> }
>
>
> ### plugin.xml ###
> <extension
> point="org.eclipse.ui.commands">
> <command
> id="aboutCommand"
> name="About">
> </command>
> </extension>
> <extension
> id="custom-bindings"
> point="org.eclipse.ui.bindings">
> <key
> commandId="aboutCommand"
> contextId="org.eclipse.ui.contexts.dialogAndWindow"
> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
> sequence="M2+M3+J">
> </key>
> </extension>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02355 seconds