shell = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE);
if ( PlatformUI.isWorkbenchRunning( ) ) { shell = new Shell( PlatformUI.getWorkbench( ) .getDisplay( ) .getActiveShell( ), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL ); } else { shell = new Shell( display, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL ); }
    private void init(String sTitle)    {        display = Display.getDefault();        shell = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE);        shell.setText(sTitle);        shell.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);        shell.setLayout(new FillLayout());        // CENTER THE DIALOG ON SCREEN        shell.setLocation((display.getClientArea().width / 2) - (shell.getSize().x / 2), (display.getClientArea().height / 2) - (shell.getSize().y / 2));        placeComponents();        shell.setDefaultButton(btnOK);        shell.open();        while(!shell.isDisposed())        {            if(!display.readAndDispatch())            {                display.sleep();            }        }    }