Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 499402

Summary: Key event listener and active keys: clear active keys doesn't work
Product: [RT] RAP Reporter: zzzz <nzanaga>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.2 M2   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/#/c/80292/
Whiteboard:

Description zzzz CLA 2016-08-09 03:10:44 EDT
I've a problem using "active keys" with key listener.
I initially setup a set of keys on the control, and this works.
But If I later clear the active keys, the result is wrong: the listener is disabled.
I expect intead to receive all keys.

Here the snippet:

        Shell shell = new Shell(display);

        Text t = new Text(shell, SWT.BORDER);
        t.setBounds(0, 0, 400, 400);

        t.setData("org.eclipse.rap.rwt.activeKeys", new String[] { "a", "b" });

        t.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                System.out.println(e.character);

                if( e.character == 'a' ) {
                    t.setData("org.eclipse.rap.rwt.activeKeys", null);
                }
            }
        });

        shell.open();




In this snippet, when you press 'a', the listener will be disabled
Note: if you set another key sequence, for example: new String[] { "x", "y" }, then It works as expected
Comment 1 Ivan Furnadjiev CLA 2016-09-05 05:29:50 EDT
Fixed in master with change https://git.eclipse.org/r/#/c/80292/