Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » popup menu disappear with background thread
popup menu disappear with background thread [message #1727717] Fri, 25 March 2016 16:43 Go to next message
Nicola Zanaga is currently offline Nicola ZanagaFriend
Messages: 56
Registered: July 2009
Member
If you apply a menu to a control, the popup menu disappear if there is any background thread that executes some UI action.
If the background thread doesn't do any action, the menu stays correctly open.

I'm using RAP rap-3.0.2-SR2-20160201-1220
Below the snippet:


        final Display display = new Display();
        Shell shell = new Shell(display);

        final Label t = new Label(shell, SWT.BORDER);
        t.setBounds(0, 0, 200, 400);

        t.addMenuDetectListener(new MenuDetectListener() {
            @Override
            public void menuDetected(MenuDetectEvent e) {
                Menu m = new Menu(t);
                MenuItem mi = new MenuItem(m, SWT.PUSH);
                mi.setText("test");

                m.setLocation(e.x, e.y);
                m.setVisible(true);
                while( !display.isDisposed() && !m.isDisposed() && m.getVisible() ) {
                    if( !display.readAndDispatch() )
                        display.sleep();
                }
                m.dispose();
            }
        });

        ServerPushSession serverPushSession = new ServerPushSession();
        serverPushSession.start();

        Thread th = new Thread() {
            int k = 0;

            @Override
            public void run() {
                for( ;; ) {
                    try {
                        Thread.sleep(500);
                    } catch( InterruptedException e ) {
                    }
                    display.asyncExec(new Runnable() {
                        @Override
                        public void run() {
                            t.setText(String.valueOf(k++));
                        }
                    });
                }
            };
        };
        th.setDaemon(true);
        th.start();

        shell.open();
        while( !shell.isDisposed() ) {
            if( !display.readAndDispatch() ) display.sleep();
        }
        display.dispose();


Re: popup menu disappear with background thread [message #1727841 is a reply to message #1727717] Mon, 28 March 2016 11:17 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,
if you code behaves differently in RAP and RCP please file a bugzilla
and attach this snippet there.
Regards,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: popup menu disappear with background thread [message #1727867 is a reply to message #1727841] Mon, 28 March 2016 17:31 Go to previous message
Nicola Zanaga is currently offline Nicola ZanagaFriend
Messages: 56
Registered: July 2009
Member
I opened bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=490533

in swt that code works fine
Previous Topic:How to terminate another user's connection?
Next Topic:[ANN] RAP 3.1 M6 published
Goto Forum:
  


Current Time: Sat Apr 27 02:25:43 GMT 2024

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

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

Back to the top