protected void setPosition() { Rectangle shellBounds = getParent().getBounds(); Point dialogSize = dialog.getSize(); dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 ); } }
private void setPosition() { Rectangle shellBounds = getParent().getBounds(); Point dialogSize = dialog.getSize(); dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 ); } }
protected void setMiddle() { Rectangle screenSize = shell.getParent().getBounds(); Rectangle shellSize = shell.getBounds(); shell.setLocation(screenSize.x + screenSize.width / 2 - shellSize.width / 2, screenSize.y + screenSize.height / 2 - shellSize.height / 2); }
protected void openDialog() { shell.pack(); // Set the focus on the OK button wOK.setFocus(); Rectangle shellBounds = getParent().getBounds(); Point dialogSize = shell.getSize(); shell.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
/** * * @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 ); }
/** * * @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 ); }
/** * * @param shell * the shell. */ public TeraFastAboutDialog( 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, "TeraFastDialog.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 ); }
Point dialogSize = shell.getSize(); shell.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 );
shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 ); closeButton.setFocus(); shell.open();
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 ); } }
int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2; shell.setLocation( middleX, middleY );
splash.setLocation( x, y );
shell.setLocation( location.x, location.y + bounds.height ); shell.setLayout( new FillLayout() ); final List list = new List( shell, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL );
private void updatePopupLocation(boolean force) { if (! force && fSnapPosition == SNAP_POSITION_LOWER_RIGHT) return; packPopup(); Point loc= computePopupLocation(fSnapPosition); if (loc != null) { fPopup.setLocation(loc); // XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774 // fPopup.moveBelow(fEditor.getSite().getShell().getShells()[0]); } }
public void setLocation(Point location) { Rectangle trim = fShell.computeTrim(0, 0, 0, 0); Point textLocation = fComposite.getLocation(); location.x += trim.x - textLocation.x; location.y += trim.y - textLocation.y; fShell.setLocation(location); }
public void setLocation(Point location) { Rectangle trim= fShell.computeTrim(0, 0, 0, 0); Point textLocation= fText.getLocation(); location.x += trim.x - textLocation.x; location.y += trim.y - textLocation.y; fShell.setLocation(location); }
public static void centerShell(Shell shell) { Rectangle displayBounds = shell.getDisplay().getPrimaryMonitor().getBounds(); Rectangle shellBounds = shell.getBounds(); int x = displayBounds.x + (displayBounds.width - shellBounds.width) >> 1; int y = displayBounds.y + (displayBounds.height - shellBounds.height) >> 1; shell.setLocation(x, y); }
private void updatePopupLocation(boolean force) { if (! force && fSnapPosition == SNAP_POSITION_LOWER_RIGHT) return; packPopup(); Point loc= computePopupLocation(fSnapPosition); if (loc != null && ! loc.equals(fPopup.getLocation())) { fPopup.setLocation(loc); // XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774 // fPopup.moveBelow(fEditor.getSite().getShell().getShells()[0]); } }
private void moveToParentDialogCenter(Shell dialog) { if (dialog.getParent() == null) { // No parent shell no positioning return; } Point dialogSize = dialog.getSize(); Rectangle parentDialogBounds = dialog.getParent().getBounds(); Point newLocation = computeCenteredLocation(dialogSize, parentDialogBounds); dialog.setLocation(newLocation); }