View Javadoc
1   package org.eclipse.rap.rwt.application;
2   
3   import org.eclipse.swt.layout.GridLayout;
4   import org.eclipse.swt.widgets.Composite;
5   import org.eclipse.swt.widgets.Display;
6   import org.eclipse.swt.widgets.Shell;
7   
8   public abstract class AbstractEntryPoint implements EntryPoint {
9   	private Display display;
10  	private Shell shell;
11  
12  	protected Shell createShell(Display display) {
13  		return new Shell(display);
14  	}
15  
16  	protected void createContents(Composite parent) {
17  
18  	}
19  
20  	public int createUI() {
21  		display = new Display();
22  		shell = createShell(display);
23  		shell.setLayout(new GridLayout(1, false));
24  		createContents(shell);
25  		if (shell.getMaximized()) {
26  			shell.layout();
27  		} else {
28  			shell.pack();
29  		}
30  		shell.open();
31  		while (!shell.isDisposed()) {
32  			if (!display.readAndDispatch()) {
33  				display.sleep();
34  			}
35  		}
36  		display.dispose();
37  		return 0;
38  	}
39  
40  	protected Shell getShell() {
41  		return shell;
42  	}
43  }