Java Code Examples for org.eclipse.swt.widgets.Shell#computeTrim()

The following examples show how to use org.eclipse.swt.widgets.Shell#computeTrim() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColumnFileCount.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
private void openFilesMiniView(DownloadManager dm, TableCell cell) {
	UISWTViewBuilderCore builder = ViewManagerSWT.getInstance().getBuilder(
			Download.class, FilesView.MSGID_PREFIX);
	if (builder == null) {
		return;
	}
	SkinnedDialog skinnedDialog = BaseMdiEntry.buildSkinnedDialog("FilesView",
			dm, builder);
	if (skinnedDialog == null) {
		return;
	}

	skinnedDialog.setTitle(dm.getDisplayName());

	Shell shell = skinnedDialog.getShell();

	Rectangle bounds = ((TableCellSWT) cell).getBoundsOnDisplay();
	bounds.y += bounds.height;
	bounds.width = 630;
	bounds.height = (16 * dm.getNumFileInfos()) + 60;
	Rectangle realBounds = shell.computeTrim(0, 0, bounds.width, bounds.height);
	realBounds.width -= realBounds.x;
	realBounds.height -= realBounds.y;
	realBounds.x = bounds.x;
	realBounds.y = bounds.y;
	if (bounds.height > 500) {
		bounds.height = 500;
	}
	shell.setBounds(realBounds);
	shell.setAlpha(230);

	Utils.verifyShellRect(shell, true);

	skinnedDialog.openUnadjusted();
}
 
Example 2
Source File: TmfAbstractToolTipHandler.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static Rectangle getBounds(Shell shell) {
    Rectangle bounds = shell.getBounds();
    if (SWT.getVersion() < 4902 && SWT.getPlatform().equals("gtk")) { //$NON-NLS-1$
        /* Bug 319612 - [Gtk] Shell.getSize() returns wrong value when created with style SWT.RESIZE | SWT.ON_TOP */
        bounds = shell.computeTrim(bounds.x, bounds.y, bounds.width, bounds.height);
    }
    return bounds;
}