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

Bug 489922

Summary: Events lost focus and get focus are fired two times
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.1 M6   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/#/c/68895/
Whiteboard:

Description zzzz CLA 2016-03-18 07:01:20 EDT
When you put a listener on a shell, events lost / get focus on text controls in the shell, are doubled:

I'm using
rap-3.0.2-SR2-20160201-1220

Code: [Select all] [Show/ hide]

    public static void casetestDoubleEventsRAP() {
        Display display = Display.getDefault();

        Shell s = new Shell();
        s.addFocusListener(new FocusListener() {
            @Override
            public void focusLost(FocusEvent event) {
                System.out.println("shell lost focus");
            }

            @Override
            public void focusGained(FocusEvent event) {
                System.out.println("shell get focus");
            }
        });

        Text txt1 = new Text(s, SWT.BORDER);
        txt1.addFocusListener(new FocusListener() {
            @Override
            public void focusLost(FocusEvent event) {
                System.out.println("txt1 lost focus");
            }

            @Override
            public void focusGained(FocusEvent event) {
                System.out.println("txt1 get focus");
            }
        });

        Text txt2 = new Text(s, SWT.BORDER);
        txt2.addFocusListener(new FocusListener() {
            @Override
            public void focusLost(FocusEvent event) {
                System.out.println("txt2 lost focus");
            }

            @Override
            public void focusGained(FocusEvent event) {
                System.out.println("txt2 get focus");
            }
        });

        s.setLayout(new FillLayout());
        s.setBounds(new Rectangle(0, 0, 600, 600));

        s.open();
        for( ;; ) {
            if( display.isDisposed() || s.isDisposed() )
                return;

            if( !display.readAndDispatch() )
                display.sleep();
        }
    }
Comment 1 Ivan Furnadjiev CLA 2016-03-18 07:27:21 EDT
I can reproduce it with RAP 3.1M5 too.
Comment 2 Ivan Furnadjiev CLA 2016-03-22 06:38:01 EDT
Fixed with change https://git.eclipse.org/r/#/c/68895/