Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 237882 Details for
Bug 422889
Unhandled event loop exception while MessageBox is open hangs UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Test program that demonstrates UI freeze
Bug422889.java (text/x-java), 2.12 KB, created by
Richard Fearn
on 2013-11-30 07:08:37 EST
(
hide
)
Description:
Test program that demonstrates UI freeze
Filename:
MIME Type:
Creator:
Richard Fearn
Created:
2013-11-30 07:08:37 EST
Size:
2.12 KB
patch
obsolete
>import java.util.Timer; >import java.util.TimerTask; > >import org.eclipse.jface.layout.GridDataFactory; >import org.eclipse.jface.layout.GridLayoutFactory; >import org.eclipse.swt.SWT; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.MessageBox; >import org.eclipse.swt.widgets.Shell; > >public class Bug422889 { > > public static void main(String[] args) { > > System.out.println("SWT version: " + SWT.getVersion()); > > final Shell shell = new Shell(); > GridLayoutFactory.swtDefaults().applyTo(shell); > > final Display display = shell.getDisplay(); > > final Button button = new Button(shell, SWT.PUSH); > button.setText("Hello"); > GridDataFactory.fillDefaults().grab(true, false).applyTo(button); > > final Timer timer = new Timer(); > timer.schedule(newThrowExceptionTask(display), 5000); > timer.schedule(newOpenMessageBoxTask(shell, display), 10000); > timer.schedule(newThrowExceptionTask(display), 15000); > > shell.open(); > while (true) { > try { > if (!display.readAndDispatch()) { > display.sleep(); > } > } catch (Throwable t) { > System.err.println(t); > } > } > } > > private static TimerTask newOpenMessageBoxTask(final Shell shell, final Display display) { > return new TimerTask() { > @Override > public void run() { > System.out.println("Requesting message box task to be executed"); > display.asyncExec(new Runnable() { > @Override > public void run() { > System.out.println("Running message box task in SWT thread"); > MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO); > messageBox.setMessage("Popup"); > messageBox.setText("Popup"); > messageBox.open(); > } > }); > } > }; > } > > private static TimerTask newThrowExceptionTask(final Display display) { > return new TimerTask() { > @Override > public void run() { > System.out.println("Requesting exception-throwing task to be executed"); > display.asyncExec(new Runnable() { > @Override > public void run() { > System.out.println("Running exception-throwing task in SWT thread"); > throw new NullPointerException(); > } > }); > } > }; > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 422889
: 237882