Skip to content

Commit 65149fe

Browse files
author
jossonsmith
committed
Add tests of Dialog#open blocking
1 parent 4da5aa5 commit 65149fe

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*******************************************************************************
2+
* Java2Script Pacemaker (http://j2s.sourceforge.net)
3+
*
4+
* Copyright (c) 2006 ognize.com and others.
5+
* All rights reserved. This program and the accompanying materials
6+
* are made available under the terms of the Eclipse Public License v1.0
7+
* which accompanies this distribution, and is available at
8+
* http://www.eclipse.org/legal/epl-v10.html
9+
*
10+
* Contributors:
11+
* ognize.com - initial API and implementation
12+
*******************************************************************************/
13+
14+
package net.sf.j2s.test.swt.widgets;
15+
16+
import org.eclipse.swt.SWT;
17+
import org.eclipse.swt.events.SelectionAdapter;
18+
import org.eclipse.swt.events.SelectionEvent;
19+
import org.eclipse.swt.layout.FillLayout;
20+
import org.eclipse.swt.widgets.Button;
21+
import org.eclipse.swt.widgets.Display;
22+
import org.eclipse.swt.widgets.MessageBox;
23+
import org.eclipse.swt.widgets.Shell;
24+
25+
public class TestDialog {
26+
27+
/**
28+
* @param args
29+
*/
30+
public static void main(String[] args) {
31+
Display display = new Display();
32+
final Shell shell = new Shell(display);
33+
shell.setLayout(new FillLayout());
34+
Button button = new Button(shell, SWT.PUSH);
35+
button.addSelectionListener(new SelectionAdapter() {
36+
37+
public void widgetSelected(SelectionEvent arg0) {
38+
System.out.println("Hello");
39+
MessageBox messageBox = new MessageBox(shell);
40+
int open = messageBox.open();
41+
System.out.println(open);
42+
}
43+
44+
});
45+
shell.open();
46+
while (!shell.isDisposed())
47+
if (!shell.getDisplay().readAndDispatch()) shell.getDisplay().sleep();
48+
display.dispose();
49+
}
50+
51+
}

0 commit comments

Comments
 (0)