@Override protected Point getInitialSize() { return getParentShell().computeSize( 368, 107 ); }
/** * Overridden to auto-size the shell according to the selected width. */ @Override protected void constrainShellSize() { super.constrainShellSize(); try { // the shell property within the Windows class is private - need to access it via reflection final Field shellField = Window.class.getDeclaredField( "shell" ); shellField.setAccessible( true ); final Shell thisShell = (Shell) shellField.get( this ); thisShell.pack(); final int height = thisShell.computeSize( width, SWT.DEFAULT ).y; thisShell.setBounds( thisShell.getBounds().x, thisShell.getBounds().y, width + 4, height + 2 ); } catch ( final Exception e ) { // nothing to do } }
private void open( final Display display ) { shell.pack(); if ( width > 0 ) { final int height = shell.computeSize( width, SWT.DEFAULT ).y; // for some reason the actual width and minimum width are smaller than what is requested - add the // SHELL_WIDTH_OFFSET to get the desired size shell.setMinimumSize( width + SHELL_WIDTH_OFFSET, height ); shell.setSize( width + SHELL_WIDTH_OFFSET, height ); } shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
private void open( final Display display ) { shell.pack(); final int height = shell.computeSize( SHELL_WIDTH, SWT.DEFAULT ).y; // for some reason the actual width and minimum width are smaller than what is requested - add the // SHELL_WIDTH_OFFSET to get the desired size shell.setMinimumSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height ); shell.setSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height ); getData( meta ); meta.setChanged( changed ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
attachTo = wButton; Point point = shell.computeSize( 436, SWT.DEFAULT ); shell.setSize( point ); shell.open();
final int height = shell.computeSize( this.width, SWT.DEFAULT ).y;
shell.setSize( shell.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ) ); Rectangle screenSize = display.getPrimaryMonitor().getBounds(); shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 );
Point computedSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Rectangle shellSize = shell.getBounds(); if ( shellSize.width < computedSize.x ) {
@Override public Point computeSize(int wHint, int hHint) { if (!inSetSize && wHint > 0 && hHint == SWT.DEFAULT) { inSetSize = true; return super.computeSize(wHint, hHint); } return super.computeSize(wHint, hHint); }
/** * Returns the initial size to use for the shell. The default implementation * returns the preferred size of the shell, using * <code>Shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)</code>. * * @return the initial size of the shell */ protected Point getInitialSize() { return shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); }
@Override public Point computeSizeHint() { // XXX: Verify whether this is a good default implementation. If yes, document it. Point constrains= getSizeConstraints(); if (constrains == null) return fShell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); return fShell.computeSize(constrains.x, constrains.y, true); }
private Rectangle computeShellBounds() { Rectangle result = new Rectangle( 0, 0, 0, 0 ); Point preferredSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); Rectangle displaySize = parent.getDisplay().getBounds(); result.x = ( displaySize.width - preferredSize.x ) / 2 + displaySize.x; result.y = ( displaySize.height - preferredSize.y ) / 2 + displaySize.y; result.width = Math.min( preferredSize.x, MAX_WIDTH ); result.height = preferredSize.y; return result; }
int SizeBrowserTo (int aCX, int aCY) { size = new Point (aCX, aCY); boolean isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0; if (isChrome) { Shell shell = browser.getShell (); shell.setSize (shell.computeSize (size.x, size.y)); } return XPCOM.NS_OK; }
@Override public Point computeSizeHint() { Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Point constrains= getSizeConstraints(); if (constrains == null) return preferedSize; int trimWidth= getShell().computeTrim(0, 0, 0, 0).width; Point constrainedSize= getShell().computeSize(constrains.x - trimWidth, SWT.DEFAULT, true); int width= Math.min(preferedSize.x, constrainedSize.x); int height= Math.max(preferedSize.y, constrainedSize.y); return new Point(width, height); }
@Override public Point computeSizeHint() { Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Point constrains= getSizeConstraints(); if (constrains == null) return preferedSize; int trimWidth= getShell().computeTrim(0, 0, 0, 0).width; Point constrainedSize= getShell().computeSize(constrains.x - trimWidth, SWT.DEFAULT, true); int width= Math.min(preferedSize.x, constrainedSize.x); int height= Math.max(preferedSize.y, constrainedSize.y); return new Point(width, height); }
@Override protected Point getInitialSize() { Point requiredSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Point lastSize= super.getInitialSize(); if (requiredSize.x > lastSize.x || requiredSize.y > lastSize.y) { return requiredSize; } return lastSize; }
protected void updateStatus(IStatus status) { super.updateStatus(status); Shell shell= getShell(); if (shell != null && ! shell.isDisposed()) { Point size= shell.getSize(); Point minSize= shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); if (minSize.x > size.x || minSize.y > size.y) { shell.setSize(minSize); } } } }
void refreshDialogSize() { if (dialogArea == null || dialogArea.isDisposed()) { return; } Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell().setSize(newSize); }
/** * Refresh the contents of the viewer. */ void refreshStatusList() { if (statusListViewer != null && !statusListViewer.getControl().isDisposed()) { statusListViewer.refresh(); Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell().setSize(newSize); } }
/** * Refresh the contents of the viewer. */ void refreshStatusList() { if (statusListViewer != null && !statusListViewer.getControl().isDisposed()) { statusListViewer.refresh(); Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell().setSize(newSize); } }