private void initShell() { shell = new Shell(); shell.addListener(SWT.Close, new Listener() { public void handleEvent(Event event) { String key = openDataContent.canClose(); if(key != null){ boolean ok = MessageDialog.openConfirm(shell, i18nFile.getText(I18nFile.CLOSEAPP), key + ": " + i18nFile.getText(I18nFile.CLOSEAPPERROR)); event.doit = ok; }else event.doit = true; } }); shell.setText("RedisClient"); shell.setLayout(new GridLayout(1, false)); }
public void open() { shell = new Shell( parentShell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); shell.setImage( GUIResource.getInstance().getImageSpoon() ); formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout( formLayout ); shell.setText( dialogTitle ); shell.open(); while ( !shell.isDisposed() ) { if ( !shell.getDisplay().readAndDispatch() ) { shell.getDisplay().sleep();
public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); final DateTime calendar = new DateTime( dialog, SWT.CALENDAR ); final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME ); new Label( dialog, SWT.NONE ); new Label( dialog, SWT.NONE ); Button ok = new Button( dialog, SWT.PUSH ); ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendar.getYear() ); cal.set( Calendar.MONTH, calendar.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() ); cal.set( Calendar.HOUR_OF_DAY, time.getHours() ); cal.set( Calendar.MINUTE, time.getMinutes() ); cal.set( Calendar.SECOND, time.getSeconds() ); wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) ); dialog.close(); } } ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open(); } } );
public static void main( String[] args ) { DeviceData data = new DeviceData(); data.tracking = true; Display display = new Display( data ); Sleak sleak = new Sleak(); Shell shell = new Shell( display ); shell.setText( "S-Leak" ); Point size = shell.getSize(); shell.setSize( size.x / 2, size.y / 2 ); sleak.create( shell ); shell.open(); // Launch your application here // e.g. // Shell shell = new Shell(display); // Button button1 = new Button(shell, SWT.PUSH); // button1.setBounds(10, 10, 100, 50); // button1.setText("Hello World"); // Image image = new Image(display, 20, 20); // Button button2 = new Button(shell, SWT.PUSH); // button2.setBounds(10, 70, 100, 50); // button2.setImage(image); // shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } display.dispose(); }
@Override public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "SalesforceInputDialog.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open();
protected void mainLayout( Class<?> PKG, String prefix, Image img ) { display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL ); props.setLook( shell ); shell.setImage( img ); shell.setLayout( new FormLayout() ); shell.setText( BaseMessages.getString( PKG, prefix + ".Shell.Title" ) ); }
/** * Open the dialog. * @return the result */ public Object open() { shell = new Shell(getParent(), getStyle()); shell.setImage(image); createContents(); shell.open(); shell.layout(); Display display = getParent().getDisplay(); while (!shell.isDisposed()) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (Exception e) { MessageDialog.openError(shell, RedisClient.i18nFile.getText(I18nFile.ERROR), e.getLocalizedMessage()); } } return result; }
@Override public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "SalesforceInputDialog.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open();
private Display prepareLayout() { // Prep the parent shell and the dialog shell final Shell parent = getParent(); final Display display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); setShellImage( shell, meta ); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { @Override public void shellClosed( ShellEvent e ) { cancel(); } } ); changed = meta.hasChanged(); final FormLayout formLayout = new FormLayout(); formLayout.marginWidth = BaseDialog.MARGIN_SIZE; formLayout.marginHeight = BaseDialog.MARGIN_SIZE; shell.setLayout( formLayout ); shell.setText( getTitle() ); return display; }
public List<Object[]> open() { shell = new Shell( parentShell, style ); props.setLook( shell ); shell.setImage( GUIResource.getInstance().getImageSpoon() ); formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout( formLayout ); shell.setText( title ); shell.open(); while ( !shell.isDisposed() ) { if ( !shell.getDisplay().readAndDispatch() ) { shell.getDisplay().sleep();
public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER ); final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME ); new Label( dialogto, SWT.NONE ); new Label( dialogto, SWT.NONE ); Button okto = new Button( dialogto, SWT.PUSH ); okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); okto.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendarto.getYear() ); cal.set( Calendar.MONTH, calendarto.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() ); cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() ); cal.set( Calendar.MINUTE, timeto.getMinutes() ); cal.set( Calendar.SECOND, timeto.getSeconds() ); wReadTo.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) ); dialogto.close(); } } ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open(); } } );
/** * Returns a {@link org.eclipse.swt.events.SelectionAdapter} that is used to "submit" the dialog. */ private Display prepareLayout() { // Prep the parent shell and the dialog shell final Shell parent = getParent(); final Display display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET ); shell.setImage( GUIResource.getInstance().getImageSpoon() ); props.setLook( shell ); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { @Override public void shellClosed( ShellEvent e ) { dispose(); } } ); final FormLayout formLayout = new FormLayout(); formLayout.marginWidth = MARGIN_SIZE; formLayout.marginHeight = MARGIN_SIZE; shell.setLayout( formLayout ); shell.setText( this.title ); return display; }
@Override public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); setShellImage( shell, input ); lsMod = new ModifyListener() { public void modifyText( ModifyEvent e ) { input.setChanged(); } }; changed = input.hasChanged(); createUI(); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed( ShellEvent e ) { cancel(); } } ); getData( input ); setSize(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } return stepname; }
public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER ); final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME ); new Label( dialogto, SWT.NONE ); new Label( dialogto, SWT.NONE ); Button okto = new Button( dialogto, SWT.PUSH ); okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); okto.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendarto.getYear() ); cal.set( Calendar.MONTH, calendarto.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() ); cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() ); cal.set( Calendar.MINUTE, timeto.getMinutes() ); cal.set( Calendar.SECOND, timeto.getSeconds() ); wReadTo.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) ); dialogto.close(); } } ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open(); } } );
/** * * @param shell * the shell. */ public OlapInputAboutDialog( final Shell shell ) { this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET ); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; this.dialog.setLayout( gridLayout ); this.dialog.setText( BaseMessages.getString( PKG, "OlapInputDialog.About.Shell.Title" ) ); this.dialog.setImage( shell.getImage() ); this.buildIconCell(); this.buildPluginInfoCell(); this.buildOkButton(); this.dialog.pack(); Rectangle shellBounds = shell.getBounds(); Point dialogSize = this.dialog.getSize(); this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 ); }
shell = new Shell( getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX ); props.setLook( shell ); formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout( formLayout ); shell.setText( BaseMessages.getString( PKG, "InfobrightLoaderDialog.Shell.Title" ) ); input.setChanged( changed ); shell.open(); while ( !shell.isDisposed() ) { Display display = getParent().getDisplay(); if ( !display.readAndDispatch() ) { display.sleep();
public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); final DateTime calendar = new DateTime( dialog, SWT.CALENDAR ); final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME ); new Label( dialog, SWT.NONE ); new Label( dialog, SWT.NONE ); Button ok = new Button( dialog, SWT.PUSH ); ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendar.getYear() ); cal.set( Calendar.MONTH, calendar.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() ); cal.set( Calendar.HOUR_OF_DAY, time.getHours() ); cal.set( Calendar.MINUTE, time.getMinutes() ); cal.set( Calendar.SECOND, time.getSeconds() ); wReadFrom.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) ); dialog.close(); } } ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open(); } } );
/** * * @param shell * the shell. */ public SapInputAboutDialog( final Shell shell ) { this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET ); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; this.dialog.setLayout( gridLayout ); this.dialog.setText( BaseMessages.getString( PKG, "SapInputDialog.About.Shell.Title" ) ); this.dialog.setImage( shell.getImage() ); this.buildIconCell(); this.buildPluginInfoCell(); this.buildOkButton(); this.dialog.pack(); Rectangle shellBounds = shell.getBounds(); Point dialogSize = this.dialog.getSize(); this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 ); }
shell = new Shell( getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX ); props.setLook( shell ); formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout( formLayout ); shell.setText( BaseMessages.getString( PKG, "IngresVectorwiseLoaderDialog.Shell.Title" )); shell.open(); while ( !shell.isDisposed() ) { Display display = getParent().getDisplay(); if ( !display.readAndDispatch() ) { display.sleep();
public void createDialog( String title, String url, int options, Image logo ) { Shell parent = getParent(); display = parent.getDisplay(); dialog = new Shell( parent, options ); dialog.setText( title ); dialog.setImage( logo ); dialog.setSize( width, height ); dialog.setLayout( new FillLayout() ); try { browser = new Browser( dialog, SWT.NONE ); browser.setUrl( url ); browser.addCloseWindowListener( new CloseWindowListener() { @Override public void close( WindowEvent event ) { Browser browser = (Browser) event.widget; Shell shell = browser.getShell(); shell.close(); } } ); } catch ( Exception e ) { MessageBox messageBox = new MessageBox( dialog, SWT.ICON_ERROR | SWT.OK ); messageBox.setMessage( "Browser cannot be initialized." ); messageBox.setText( "Exit" ); messageBox.open(); } setPosition(); dialog.open(); }