public String open() { shell.layout(); shell.open(); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed( ShellEvent e ) { cancel(); } } ); while ( !shell.isDisposed() ) { if ( !shell.getDisplay().readAndDispatch() ) { shell.getDisplay().sleep(); } } return formula; }
/** * Open the window. * */ public void open() { Display display = null; display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (Exception e) { MessageDialog.openError(shell, i18nFile.getText(I18nFile.ERROR), e.getLocalizedMessage()); e.printStackTrace(); } } display.dispose(); }
/** * 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; }
data.exclude = b.getSelection(); bHidden.setVisible(!data.exclude); shell.layout(false);
shell.layout(); shell.pack( true ); shell.open();
shell.layout(); if ( !scroll ) { shell.pack( true );
shell.layout();
public static void setSize( Shell shell, int minWidth, int minHeight, boolean packIt ) { PropsUI props = PropsUI.getInstance(); WindowProperty winprop = props.getScreen( shell.getText() ); if ( winprop != null ) { winprop.setShell( shell, minWidth, minHeight ); } else { if ( packIt ) { shell.pack(); } else { shell.layout(); } // OK, sometimes this produces dialogs that are waay too big. // Try to limit this a bit, m'kay? // Use the same algorithm by cheating :-) // winprop = new WindowProperty( shell ); winprop.setShell( shell, minWidth, minHeight ); // Now, as this is the first time it gets opened, try to put it in the middle of the screen... Rectangle shellBounds = shell.getBounds(); Monitor monitor = shell.getDisplay().getPrimaryMonitor(); if ( shell.getParent() != null ) { monitor = shell.getParent().getMonitor(); } Rectangle monitorClientArea = monitor.getClientArea(); int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2; int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2; shell.setLocation( middleX, middleY ); } }
public static void setSize( Shell shell, int prefWidth, int prefHeight ) { PropsUI props = PropsUI.getInstance(); WindowProperty winprop = props.getScreen( shell.getText() ); if ( winprop != null ) { winprop.setShell( shell, prefWidth, prefHeight ); } else { shell.layout(); winprop = new WindowProperty( shell.getText(), false, new Rectangle( 0, 0, prefWidth, prefHeight ) ); winprop.setShell( shell ); // Now, as this is the first time it gets opened, try to put it in the middle of the screen... Rectangle shellBounds = shell.getBounds(); Monitor monitor = shell.getDisplay().getPrimaryMonitor(); if ( shell.getParent() != null ) { monitor = shell.getParent().getMonitor(); } Rectangle monitorClientArea = monitor.getClientArea(); int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2; int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2; shell.setLocation( middleX, middleY ); } }
shell.pack(); } else { shell.layout();
@SuppressWarnings( "deprecation" ) @Override public void show( boolean force ) { if ( ( force ) || ( !buttonsCreated ) ) { setButtons(); } isDialogHidden = false; dialog.getShell().setText( title ); // Remember the size from a last time or do proper layouting of the window. // if ( getWidth() > 0 && getHeight() > 0 ) { BaseStepDialog.setSize( getShell(), getWidth(), getHeight(), true ); } else { BaseStepDialog.setSize( getShell() ); } width = getShell().getSize().x; height = getShell().getSize().y; dialog.getShell().layout( true, true ); // Timing is everything - fire the onLoad events so that anyone who is trying to listens gets notified // notifyListeners( XulRoot.EVENT_ON_LOAD ); setAppicon( appIcon ); returnCode = dialog.open(); }
shell.layout( true, true );
wFields.setLayoutData( fdFields ); shell.layout( true, true );
shell.layout( true, true );
shell.layout();
@Override public void handleEvent(Event e) { existing_mapping = new int[0][0]; for (int uid: item_uids ) { existing_mapping = ensureUIDInLayout( existing_mapping, uid ); } buildGrid(); shell.layout( true, true ); } });
/** * @deprecated As of SWT 4.6 (Neon), this functionality is {@link Control#requestLayout()}. */ @Deprecated public static void requestLayout(Control control) { if (control instanceof Shell) { ((Shell) control).layout(null, SWT.DEFER); } else { control.getShell().layout(new Control[]{control}, SWT.DEFER); } }
int OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { int currentKBytes = aCurTotalProgress / 1024; int totalKBytes = aMaxTotalProgress / 1024; if (shell != null && !shell.isDisposed ()) { Object[] arguments = {new Integer (currentKBytes), new Integer (totalKBytes)}; String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$ status.setText (statusMsg); shell.layout (true); shell.getDisplay ().update (); } return XPCOM.NS_OK; }
@Override public void handleEvent(Event event) { GridData gridData = (GridData) cPaint.getLayoutData(); gridData.heightHint = spinnerHeight.getSelection(); cPaint.setLayoutData(gridData); shell.layout(); } });
public void showHeapStatus(boolean show) { MUIElement hsElement = modelService.find("org.eclipse.ui.HeapStatus", model); //$NON-NLS-1$ if (hsElement != null && hsElement.isToBeRendered() != show) { hsElement.setToBeRendered(show); getShell().layout(null, SWT.ALL | SWT.CHANGED | SWT.DEFER); } }