X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=rcp%2Forg.argeo.eclipse.ui.rcp%2Fsrc%2Forg%2Feclipse%2Frap%2Frwt%2Fapplication%2FAbstractEntryPoint.java;fp=rcp%2Forg.argeo.eclipse.ui.rcp%2Fsrc%2Forg%2Feclipse%2Frap%2Frwt%2Fapplication%2FAbstractEntryPoint.java;h=980a8185445740a81f356657f007621c80472450;hb=05b37fe95b9379c17061463d84f67145c2e11371;hp=0000000000000000000000000000000000000000;hpb=54453ccd2a0525236250c150f6b720e8fcac5c53;p=lgpl%2Fargeo-commons.git diff --git a/rcp/org.argeo.eclipse.ui.rcp/src/org/eclipse/rap/rwt/application/AbstractEntryPoint.java b/rcp/org.argeo.eclipse.ui.rcp/src/org/eclipse/rap/rwt/application/AbstractEntryPoint.java new file mode 100644 index 000000000..980a81854 --- /dev/null +++ b/rcp/org.argeo.eclipse.ui.rcp/src/org/eclipse/rap/rwt/application/AbstractEntryPoint.java @@ -0,0 +1,43 @@ +package org.eclipse.rap.rwt.application; + +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public abstract class AbstractEntryPoint implements EntryPoint { + private Display display; + private Shell shell; + + protected Shell createShell(Display display) { + return new Shell(display); + } + + protected void createContents(Composite parent) { + + } + + public int createUI() { + display = new Display(); + shell = createShell(display); + shell.setLayout(new GridLayout(1, false)); + createContents(shell); + if (shell.getMaximized()) { + shell.layout(); + } else { + shell.pack(); + } + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) { + display.sleep(); + } + } + display.dispose(); + return 0; + } + + protected Shell getShell() { + return shell; + } +}