List of usage examples for org.eclipse.jface.util Geometry getExtrudedEdge
public static Rectangle getExtrudedEdge(Rectangle toExtrude, int size, int orientation)
From source file:au.gov.ga.earthsci.jface.extras.information.AbstractInformationControlManager.java
License:Open Source License
/** * Gets the closest monitor given an anchor and the subject area. * * @param area the subject area/*www . jav a 2 s . c o m*/ * @param anchor the anchor * @return the monitor closest to the edge of <code>area</code> defined by * <code>anchor</code> * @since 3.3 */ private Monitor getClosestMonitor(Rectangle area, Anchor anchor) { Point center; if (ANCHOR_GLOBAL == anchor) center = Geometry.centerPoint(area); else center = Geometry.centerPoint(Geometry.getExtrudedEdge(area, 0, anchor.getSWTFlag())); return getClosestMonitor(fSubjectControl.getDisplay(), Geometry.createRectangle(center, new Point(0, 0))); }
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 w w.jav a 2s . com */ 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 ww . java 2s. c om */ 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); }
From source file:org.eclipse.ui.internal.FastViewPane.java
License:Open Source License
private Rectangle getBounds() { Rectangle bounds = getClientArea(); if (site.getState() == IStackPresentationSite.STATE_MAXIMIZED) { return bounds; }/* w w w. j ava 2s . com*/ boolean horizontal = Geometry.isHorizontal(side); int available = Geometry.getDimension(bounds, !horizontal); return Geometry.getExtrudedEdge(bounds, Math.min(FastViewPane.this.size, available), side); }
From source file:org.eclipse.ui.internal.FastViewPane.java
License:Open Source License
/** * Updates the position of the resize sash. *//*from ww w . j a v a 2s . c o m*/ private void updateFastViewSashBounds() { Rectangle bounds = getBounds(); int oppositeSide = Geometry.getOppositeSide(side); Rectangle newBounds = Geometry.getExtrudedEdge(bounds, -getSashSize(), oppositeSide); Rectangle oldBounds = sash.getBounds(); if (!newBounds.equals(oldBounds)) { sash.setBounds(newBounds); } }