Example usage for org.eclipse.jface.util Geometry setDimension

List of usage examples for org.eclipse.jface.util Geometry setDimension

Introduction

In this page you can find the example usage for org.eclipse.jface.util Geometry setDimension.

Prototype

public static void setDimension(Rectangle toSet, boolean width, int newCoordinate) 

Source Link

Document

Sets one dimension of the given rectangle.

Usage

From source file:org.eclipse.ui.internal.FastViewBar.java

License:Open Source License

/**
 * Returns the approximate location where the next fastview icon
 * will be drawn (display coordinates)/*  w  ww  .ja  v a 2 s  . co  m*/
 */
public Rectangle getLocationOfNextIcon() {
    ToolBar control = getToolBar();

    Rectangle result = control.getBounds();
    Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
    result.height = size.y;
    result.width = size.x;

    boolean horizontal = Geometry.isHorizontal(getSide());
    if (control.getItemCount() == 0) {
        Geometry.setDimension(result, horizontal, 0);
    }

    int hoverSide = horizontal ? SWT.RIGHT : SWT.BOTTOM;

    result = Geometry.getExtrudedEdge(result, -Geometry.getDimension(result, !horizontal), hoverSide);

    return Geometry.toDisplay(control.getParent(), result);
}

From source file:org.eclipse.ui.internal.FastViewDnDHandler.java

License:Open Source License

/**
 * Returns the approximate location where the next fastview icon
 * will be drawn (display coordinates)//from  w w w  .  j av a 2s  .  c  o  m
 */
public Rectangle getLocationOfNextIcon() {
    ToolBar control = tbm.getControl();

    Rectangle result = control.getBounds();
    Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
    result.height = size.y;
    result.width = size.x;

    boolean horizontal = (control.getStyle() & SWT.VERTICAL) == 0;
    if (control.getItemCount() == 0) {
        Geometry.setDimension(result, horizontal, 0);
    }

    int hoverSide = horizontal ? SWT.RIGHT : SWT.BOTTOM;

    result = Geometry.getExtrudedEdge(result, -Geometry.getDimension(result, !horizontal), hoverSide);

    return Geometry.toDisplay(control.getParent(), result);
}