Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Correct usage of ProgressMonitorDialog with modal dialogs
Correct usage of ProgressMonitorDialog with modal dialogs [message #1732929] Mon, 23 May 2016 08:13 Go to next message
Wojtek Polcwiartek is currently offline Wojtek PolcwiartekFriend
Messages: 3
Registered: May 2016
Junior Member
Hallo,

I am struggling with the correct usage of the ProgressMonitorDialog in an RAP/RWT enviroment.
My scenario is to run a IRunnableWithProgress with ProgressMonitorDialog#run(), while the "fork"-flag is set (true; "ModalContext"-thread spawns).
This IRunnableWithProgress opens a blocking MessageDialog. While this MessageDialog is open, I close the web-browser window.
I could observe, that the "ModalContext"-thread hangs in this situation. The "ModalContext"-thread waits for a lock, owned by UIThread, which gets terminated, so it waits forever.
Can you give me a clue, how to open modal dialogs with ProgressMonitorDialog#run() properly?
I attached an EntryPoint, that demonstrates this behavior.
Re: Correct usage of ProgressMonitorDialog with modal dialogs [message #1732977 is a reply to message #1732929] Mon, 23 May 2016 13:56 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,
I saw your bug report here:
493870: Correct usage of ProgressMonitorDialog with modal dialogs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=493870)
but I didn't have time to investigate the issue. Is the issue
reproducible with our Workbench Demo (Planning perspective) when "Start
Job with Dialog" toolbar button is used?
Regards,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Correct usage of ProgressMonitorDialog with modal dialogs [message #1733097 is a reply to message #1732977] Tue, 24 May 2016 10:59 Go to previous message
Wojtek Polcwiartek is currently offline Wojtek PolcwiartekFriend
Messages: 3
Registered: May 2016
Junior Member
Hallo Ivan,

I could reproduce this behaviour with the "RAP Examples Demo" (the Workbench Demo does not use the ModalContext-Thread).
I used the demo "Basic Widgets"->"Dialogs"->"Progress Dialog", but I needed to modify the o.e.r.e.p.DialogExamplePage.showProgressDialog()-Method.
  private void showProgressDialog() {
    final ProgressMonitorDialog dialog = new ProgressMonitorDialog( getShell() ) {

      @Override
      public boolean close() {
        return super.close();
      }
    };
    dialog.setBlockOnOpen( false );
    try {
      dialog.run( true, true, new IRunnableWithProgress() {

        @Override
        public void run( IProgressMonitor monitor )
          throws InvocationTargetException, InterruptedException
        {
          monitor.beginTask( "Counting to 12...", 12 );
          for( int i = 1; !monitor.isCanceled() && i <= 12; i++ ) {
            monitor.worked( 1 );
            Thread.sleep( 300 );
          }
          // open a blocking dialog 
          dialog.getShell().getDisplay().syncExec( new Runnable() {
            @Override
            public void run() {
              MessageDialog.openInformation( getShell(), "Blocking Dialog", "Hallo!" );
            }
          } );
          monitor.done();
        }
      } );
    } catch( Exception e ) {
      MessageDialogUtil.openError( getShell(), "Error", e.getMessage(), null );
    }
  }


I start the demo, use the "Progress Dialog"-Button, and wait until the "Blocking Dialog" comes. Then I close the Webbrowser. The result is a terminated UIThread, and
a hanging "ModalContext"-Thread.
I posted this question first as a bug, but I am not sure, if it is one. It could be a bug, because not all of the
resources (here: threads) belonging to a session, are closed when the session terminates. But maybe I just use the frameworks in a wrong way.

Best Regards,
Wojtek
Previous Topic:best way to distinguish main ui thread and background threads
Next Topic:[ANN] RAP 3.1 RC2 published
Goto Forum:
  


Current Time: Sat Apr 27 04:33:40 GMT 2024

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

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

Back to the top