Bug 161902 [JFace] Enhancements to GridLayoutFactory.margins
This enhancement requests the following: 1. Rename the new GridLayoutFactory.margins(int,int,int,int) to GridLayoutFactory.extendedMargins(int,int,int,int) 2. Add a GridLayoutFactory.extendedMargins(Rectangle) method that accepts a difference rectangle. 3. Add static methods to Geometry in order to easily construct difference rectangles. Why? 1. We should not use overloaded methods in GridLayoutFactory unless they really do set the same thing. Since the four-argument margins(...) method and the two-argument margins(...) method set independent values, we should give them different names or clients will expect a call to margins(int, int, int, int) to overwrite a previous call to margins(int, int). 2. All methods on GridLayoutFactory and GridDataFactory should have vector initializers, so that clients can store and reuse standard margin settings in a single variable. 3. Vector initializers are only a convenience if there is a convenient way to construct the vector.
bundles/org.eclipse.jface/src/org/eclipse/jface/util/Geometry.java
* Converts the given rectangle from the local coordinate system of the given object
     * into display coordinates.
     * 
     * @param coordinateSystem local coordinate system being converted from
     * @param toConvert rectangle to convert
     * @return a rectangle in display coordinates
     * @since 3.0
     */
    public static Rectangle toDisplay(Control coordinateSystem,
            Rectangle toConvert) {
    	return(coordinateSystem.getDisplay().map
    			(coordinateSystem,null,toConvert));   
    }
    /**
     * Determines where the given point lies with respect to the given rectangle.
     * Returns a combination of SWT.LEFT, SWT.RIGHT, SWT.TOP, and SWT.BOTTOM, combined
     * with bitwise or (for example, returns SWT.TOP | SWT.LEFT if the point is to the
     * upper-left of the rectangle). Returns 0 if the point lies within the rectangle.
     * Positions are in screen coordinates (ie: a point is to the upper-left of the
     * rectangle if its x and y coordinates are smaller than any point in the rectangle)
     *  
     * @param boundary normalized boundary rectangle 
     * @param toTest point whose relative position to the rectangle is being computed
     * @return one of SWT.LEFT | SWT.TOP, SWT.TOP, SWT.RIGHT | SWT.TOP, SWT.LEFT, 0,
     * SWT.RIGHT, SWT.LEFT | SWT.BOTTOM, SWT.BOTTOM, SWT.RIGHT | SWT.BOTTOM
     * @since 3.0
     */
    public static int getRelativePosition(Rectangle boundary, Point toTest) {
        int result = 0;
        if (toTest.x < boundary.x) {