List of usage examples for org.eclipse.jface.util Geometry toControl
public static Rectangle toControl(Control coordinateSystem, Rectangle toConvert)
From source file:com.aptana.ide.core.ui.DefaultAnimationFeedback.java
License:Open Source License
public void renderStep(double amount) { if (shellRegion != null) { shellRegion.dispose();/* w ww .j a va2 s.co m*/ shellRegion = new Region(display); } // Iterate across the set of start/end rects Iterator startIter = startRects.iterator(); Iterator endIter = endRects.iterator(); while (startIter.hasNext()) { Rectangle start = (Rectangle) startIter.next(); Rectangle end = (Rectangle) endIter.next(); // Get the bounds of the interpolated rect Rectangle curRect = RectangleAnimation.interpolate(start, end, amount); Rectangle rect = Geometry.toControl(theShell, curRect); shellRegion.add(rect); rect.x += LINE_WIDTH; rect.y += LINE_WIDTH; rect.width = Math.max(0, rect.width - 2 * LINE_WIDTH); rect.height = Math.max(0, rect.height - 2 * LINE_WIDTH); shellRegion.subtract(rect); } theShell.setRegion(shellRegion); display.update(); }
From source file:eu.jucy.gui.representation.ProxyControl.java
License:Open Source License
/** * Moves the target control on top of the dummy control. *//*from w w w . j ava 2s .c o m*/ public void layout() { if (getTargetControl() == null) { return; } // Compute the unclipped bounds of the target in display coordinates Rectangle displayBounds = Geometry.toDisplay(control.getParent(), control.getBounds()); // Clip the bounds of the target so that it doesn't go outside the dummy control's parent Rectangle clippingRegion = DragUtil.getDisplayBounds(control.getParent()); displayBounds = displayBounds.intersection(clippingRegion); // Compute the bounds of the target, in the local coordinate system of its parent Rectangle targetBounds = Geometry.toControl(getTargetControl().getParent(), displayBounds); // Move the target getTargetControl().setBounds(targetBounds); }
From source file:org.eclipse.rap.demo.presentation.StackPresentationImpl.java
License:Open Source License
protected void layout() { if (current != null) { Rectangle clientArea = DragUtil.getDisplayBounds(content); Rectangle bounds = Geometry.toControl(current.getControl().getParent(), clientArea); current.setBounds(bounds);//from ww w . j a va 2s . co m } }
From source file:org.eclipse.ui.internal.ImageAnimationFeedback.java
License:Open Source License
public void addStartRect(Rectangle rect) { if (rect != null) { Rectangle start = Geometry.toControl(theShell, rect); startRects.add(start);//from w w w .j av a2s .c o m Image image = new Image(display, rect.width, rect.height); GC gc = new GC(display); gc.copyArea(image, rect.x, rect.y); gc.dispose(); ImageCanvas canvas = new ImageCanvas(theShell, SWT.BORDER | SWT.NO_BACKGROUND, image); controls.add(canvas); } }
From source file:org.eclipse.ui.internal.ImageAnimationFeedback.java
License:Open Source License
public void addEndRect(Rectangle rect) { if (rect != null) { Rectangle end = Geometry.toControl(theShell, rect); endRects.add(end); } }
From source file:org.eclipse.ui.internal.LegacyAnimationFeedback.java
License:Open Source License
public void renderStep(AnimationEngine engine) { if (shellRegion != null) { shellRegion.dispose();//from www.j ava 2 s .c o m shellRegion = new Region(getAnimationShell().getDisplay()); } // Iterate across the set of start/end rects Iterator currentRects = getCurrentRects(engine.amount()).iterator(); while (currentRects.hasNext()) { Rectangle curRect = (Rectangle) currentRects.next(); Rectangle rect = Geometry.toControl(getAnimationShell(), curRect); shellRegion.add(rect); rect.x += LINE_WIDTH; rect.y += LINE_WIDTH; rect.width = Math.max(0, rect.width - 2 * LINE_WIDTH); rect.height = Math.max(0, rect.height - 2 * LINE_WIDTH); shellRegion.subtract(rect); } getAnimationShell().setRegion(shellRegion); getAnimationShell().getDisplay().update(); }
From source file:org.eclipse.ui.internal.presentations.defaultpresentation.NativeTabFolder.java
License:Open Source License
public Rectangle getClientArea() { Control content = viewForm.getContent(); if (content == null) { return new Rectangle(0, 0, 0, 0); }// ww w. ja v a 2s. c om return Geometry.toControl(control, DragUtil.getDisplayBounds(content)); }
From source file:org.eclipse.ui.internal.presentations.util.PresentablePartFolder.java
License:Open Source License
/** *///from w ww . jav a2 s . c o m private void layoutContent() { if (current != null) { Rectangle clientArea = DragUtil.getDisplayBounds(contentProxy); current.setBounds(Geometry.toControl(folder.getControl().getParent(), clientArea)); } }
From source file:org.eclipse.ui.internal.presentations.util.ProxyControl.java
License:Open Source License
/** * Moves the target control on top of the dummy control. *///from ww w. j a va 2 s . c om public void layout() { if (getTarget() == null) { return; } // Compute the unclipped bounds of the target in display coordinates Rectangle displayBounds = Geometry.toDisplay(control.getParent(), control.getBounds()); // Clip the bounds of the target so that it doesn't go outside the dummy control's parent Rectangle clippingRegion = DragUtil.getDisplayBounds(control.getParent()); displayBounds = displayBounds.intersection(clippingRegion); // Compute the bounds of the target, in the local coordinate system of its parent Rectangle targetBounds = Geometry.toControl(getTarget().getParent(), displayBounds); // Move the target getTarget().setBounds(targetBounds); }
From source file:org.eclipse.ui.internal.RectangleAnimationImageFeedback.java
License:Open Source License
public void changeCoordinates() { Iterator startRectIter = getStartRects().iterator(); Iterator endRectIter = getEndRects().iterator(); while (startRectIter.hasNext()) { Rectangle startRect = (Rectangle) startRectIter.next(); Rectangle mapStartRect = Geometry.toControl(theShell, startRect); startRect.x = mapStartRect.x;/*from w w w . ja v a2 s . com*/ startRect.y = mapStartRect.y; Rectangle endRect = (Rectangle) endRectIter.next(); Rectangle mapEndRect = Geometry.toControl(theShell, endRect); endRect.x = mapEndRect.x; endRect.y = mapEndRect.y; } }