List of usage examples for org.eclipse.jface.util Geometry min
public static Point min(Point p1, Point p2)
From source file:au.gov.ga.earthsci.jface.extras.information.AbstractInformationControlManager.java
License:Open Source License
/** * Opens the information control with the given information and the specified * subject area. It also activates the information control closer. * * @param subjectArea the information area * @param information the information/*from w w w . j a va2s .c o m*/ */ private void internalShowInformationControl(Rectangle subjectArea, Object information) { if (this instanceof InformationControlReplacer) { ((InformationControlReplacer) this).showInformationControl(subjectArea, information); return; } IInformationControl informationControl = getInformationControl(); if (informationControl != null) { Point sizeConstraints = computeSizeConstraints(fSubjectControl, fSubjectArea, informationControl); if (informationControl instanceof IInformationControlExtension3) { IInformationControlExtension3 iControl3 = (IInformationControlExtension3) informationControl; Rectangle trim = iControl3.computeTrim(); sizeConstraints.x += trim.width; sizeConstraints.y += trim.height; } informationControl.setSizeConstraints(sizeConstraints.x, sizeConstraints.y); if (informationControl instanceof IInformationControlExtension2) ((IInformationControlExtension2) informationControl).setInput(information); else informationControl.setInformation(information.toString()); if (informationControl instanceof IInformationControlExtension) { IInformationControlExtension extension = (IInformationControlExtension) informationControl; if (!extension.hasContents()) return; } Point size = null; Point location = null; Rectangle bounds = restoreInformationControlBounds(); if (bounds != null) { if (bounds.x > -1 && bounds.y > -1) location = Geometry.getLocation(bounds); if (bounds.width > -1 && bounds.height > -1) size = Geometry.getSize(bounds); } if (size == null) size = informationControl.computeSizeHint(); if (fEnforceAsMinimalSize) size = Geometry.max(size, sizeConstraints); if (fEnforceAsMaximalSize) size = Geometry.min(size, sizeConstraints); if (location == null) location = computeInformationControlLocation(subjectArea, size); Rectangle controlBounds = Geometry.createRectangle(location, size); cropToClosestMonitor(controlBounds); location = Geometry.getLocation(controlBounds); size = Geometry.getSize(controlBounds); informationControl.setLocation(location); informationControl.setSize(size.x, size.y); showInformationControl(subjectArea); } }
From source file:com.buglabs.bug.dragonfly.uitests.DndUtil.java
License:Open Source License
/** * Performs a DND operation to an arbitrary location. The drag start * location will be chosen depending on this widget's default * implementation.//from www . ja v a 2 s . co m * * @param source * the source widget to drag * @param target * The target locations where the DND shall finish. * @see #before(AbstractSWTBot) * @see #on(AbstractSWTBot) * @see #after(AbstractSWTBot) */ public void dragAndDrop(final AbstractSWTBot<? extends Widget> source, final Point target) { final Rectangle sourceLocation = absoluteLocation(source); final Point slightOffset = Geometry.add(Geometry.getLocation(sourceLocation), new Point(DRAG_THRESHOLD, DRAG_THRESHOLD)); doDragAndDrop(Geometry.min(Geometry.centerPoint(sourceLocation), slightOffset), target); }
From source file:org.eclipse.sirius.tests.swtbot.support.utils.dnd.DndUtil.java
License:Open Source License
/** * Performs a DND operation to an arbitrary location. The drag start * location will be chosen depending on this widget's default * implementation.//w ww . j av a2s . co m * * @param source * the source widget to drag * @param target * The target locations where the DND shall finish. * @see #before(AbstractSWTBot) * @see #on(AbstractSWTBot) * @see #after(AbstractSWTBot) */ public void dragAndDrop(final AbstractSWTBot<? extends Widget> source, final Point target) { final Rectangle sourceLocation = DndUtil.absoluteLocation(source); final Point slightOffset = Geometry.add(Geometry.getLocation(sourceLocation), new Point(DndUtil.DRAG_THRESHOLD, DndUtil.DRAG_THRESHOLD)); doDragAndDrop(Geometry.min(Geometry.centerPoint(sourceLocation), slightOffset), target); }
From source file:org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper.java
License:Open Source License
public static void dnd(final TreeItem ti, final TreeItem ti2) { Rectangle r1 = UIThreadRunnable.syncExec(new Result<Rectangle>() { public Rectangle run() { return ti.getDisplay().map(ti.getParent(), null, ti.getBounds()); }//from ww w . ja v a2 s .c o m }); final Point slightOffset = Geometry.add(Geometry.getLocation(r1), new Point(10, 10)); Rectangle r2 = UIThreadRunnable.syncExec(new Result<Rectangle>() { public Rectangle run() { return ti2.getDisplay().map(ti2.getParent(), null, ti2.getBounds()); } }); doDragAndDrop(Geometry.min(Geometry.centerPoint(r1), slightOffset), Geometry.centerPoint(r2)); }
From source file:org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper.java
License:Open Source License
public static void dnd(final TreeItem ti, final FigureCanvas fc) { Rectangle r1 = UIThreadRunnable.syncExec(new Result<Rectangle>() { public Rectangle run() { return ti.getDisplay().map(ti.getParent(), null, ti.getBounds()); }/* w w w . ja v a 2s. c o m*/ }); final Point slightOffset = Geometry.add(Geometry.getLocation(r1), new Point(10, 10)); Rectangle r2 = UIThreadRunnable.syncExec(new Result<Rectangle>() { public Rectangle run() { return fc.getDisplay().map(fc.getParent(), null, fc.getBounds()); } }); doDragAndDrop(Geometry.min(Geometry.centerPoint(r1), slightOffset), Geometry.centerPoint(r2)); }
From source file:org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper.java
License:Open Source License
public static void dnd(final TreeItem ti, final Control fc, final int x, final int y) { Rectangle r1 = UIThreadRunnable.syncExec(new Result<Rectangle>() { public Rectangle run() { return ti.getDisplay().map(ti.getParent(), null, ti.getBounds()); }// w w w . ja va2 s.c om }); final Point slightOffset = Geometry.add(Geometry.getLocation(r1), new Point(10, 10)); Point r2 = UIThreadRunnable.syncExec(new Result<Point>() { public Point run() { log.info("xxx: " + fc.getLocation().x + ":" + fc.getLocation().y); return fc.getDisplay().map(fc, null, x, y); } }); doDragAndDrop(Geometry.min(Geometry.centerPoint(r1), slightOffset), r2); }