Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » KeyBindings in RAP
KeyBindings in RAP [message #729579] Mon, 26 September 2011 14:54 Go to next message
Amandeep Chahal is currently offline Amandeep ChahalFriend
Messages: 85
Registered: September 2011
Location: India
Member
I have a lot of actions in my RAP application (menu actions, context menu actions. other actions) for which I need to add keyboard shortcuts. These have been added by defining keybindings in my manifest using 'org.eclipse.ui.binding', All of these were working in my RCP version of the application, but in RAP they don't.

So, I used the following code to add my key bindings :
display.setData(RWT.ACTIVE_KEYS,new String[]{"My key combination -Ex CTRL+F11"});
display.addFilter(SWT.KeyDown, new Listener() {

public void handleEvent(Event event) {
// Invoke action here
}
});


This works as expected.
I want to know is if there's an easier/non-programmatic way to do it. Because this way of doing it is quite tedious, given the number of actions I need to register.
Re: KeyBindings in RAP [message #729696 is a reply to message #729579] Mon, 26 September 2011 19:14 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
the 'org.eclipse.ui.binding' extension point should work in RAP too. If
not, please file a bugzilla with a simple project to reproduce it.
Thanks,
Ivan

On 9/26/2011 5:54 PM, amandeep.chahal wrote:
> I have a lot of actions in my RAP application (menu actions, context
> menu actions. other actions) for which I need to add keyboard
> shortcuts. These have been added by defining keybindings in my
> manifest using 'org.eclipse.ui.binding', All of these were working in
> my RCP version of the application, but in RAP they don't.
>
> So, I used the following code to add my key bindings :
> display.setData(RWT.ACTIVE_KEYS,new String[]{"My key combination -Ex
> CTRL+F11"});
> display.addFilter(SWT.KeyDown, new Listener() {
>
> public void handleEvent(Event event) {
> // Invoke action here
> }
> });
>
> This works as expected. I want to know is if there's an
> easier/non-programmatic way to do it. Because this way of doing it is
> quite tedious, given the number of actions I need to register.
Re: KeyBindings in RAP [message #730046 is a reply to message #729696] Tue, 27 September 2011 14:33 Go to previous messageGo to next message
sielver Mising name is currently offline sielver Mising nameFriend
Messages: 42
Registered: September 2011
Member
I just used the said extension point for the first time in my RAP application and they (bindings) seem to work pretty well.
Re: KeyBindings in RAP [message #730438 is a reply to message #730046] Wed, 28 September 2011 12:18 Go to previous messageGo to next message
Amandeep Chahal is currently offline Amandeep ChahalFriend
Messages: 85
Registered: September 2011
Location: India
Member
May I ask how you did it? Because for me only the default key bindings work. The custom ones that I define at the application level are not sent to the server at all. I also saw that the RWT_ACTIVE_KEYS is set to the default set of keys (which is basically the short cut keys available in Eclipse RCP).
Re: KeyBindings in RAP [message #730880 is a reply to message #730438] Thu, 29 September 2011 12:47 Go to previous messageGo to next message
sielver Mising name is currently offline sielver Mising nameFriend
Messages: 42
Registered: September 2011
Member
I didn't use any direct code. Here's a snippet from my plugin.xml:
<extension
         point="org.eclipse.ui.bindings">
      <key
            commandId="Lchat.deleteGroup"
            contextId="org.eclipse.ui.contexts.window"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="DELETE">
      </key>
   </extension>


This binds the Del key to the command "Lchat.deleteGroup". That's all I did!

Note that I only use commands, not actions, after reading this:
http://stackoverflow.com/questions/552435/eclipse-rcp-actions-vs-commands
Re: KeyBindings in RAP [message #897592 is a reply to message #730438] Tue, 24 July 2012 16:13 Go to previous messageGo to next message
Charles Tubbs is currently offline Charles TubbsFriend
Messages: 35
Registered: March 2012
Member
According to the documentation, you need to set the RWT.DELETE_KEYS value to those custom keys you want sent to the server (so they are not processed by the browser).

My question is what values do you use for key strings? "My key combination -Ex CTRL+F11" seems a little arbitrary. I am assuming that strings corresponding to the SWT. key code member names expressed as strings are the ticket, but ASSUMING has gotten me in trouble in the past. Does anybody have a clarification?
Re: KeyBindings in RAP [message #897791 is a reply to message #897592] Wed, 25 July 2012 09:05 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi!

Am 24.07.2012 18:13, schrieb Charles Tubbs:
> According to the documentation, you need to set the RWT.DELETE_KEYS
I'm assuming you mean CANCEL_KEYS. Just making sure.

> My question is what values do you use for key strings? "My key

This is explained on the JavaDoc for the ACTIVE_KEYS/CANCEL_KEYS
constants. Apparently we should make that clear in the documentation.

Greetings,
Tim

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: KeyBindings in RAP [message #897998 is a reply to message #897791] Wed, 25 July 2012 15:16 Go to previous message
Charles Tubbs is currently offline Charles TubbsFriend
Messages: 35
Registered: March 2012
Member
Thanks Tim!
Previous Topic:[ANN] RAP 1.4 SR1 is available
Next Topic:Views: drag and drop them around the perspective
Goto Forum:
  


Current Time: Thu Apr 25 01:15:32 GMT 2024

Powered by FUDForum. Page generated in 0.03448 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top