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 boolean into an SWT orientation constant.
     * 
     * @param horizontal if true, returns SWT.HORIZONTAL. If false, returns SWT.VERTICAL 
     * @return SWT.HORIZONTAL or SWT.VERTICAL.
     * @since 3.0
     */
    public static int getSwtHorizontalOrVerticalConstant(boolean horizontal) {
        if (horizontal) {
            return SWT.HORIZONTAL;
        }
		return SWT.VERTICAL;
    }
    /**
     * Returns true iff the given SWT side constant corresponds to a horizontal side
     * of a rectangle. That is, returns true for the top and bottom but false for the
     * left and right.
     * 
     * @param swtSideConstant one of SWT.TOP, SWT.BOTTOM, SWT.LEFT, or SWT.RIGHT
     * @return true iff the given side is horizontal.
     * @since 3.0
     */
    public static boolean isHorizontal(int swtSideConstant) {
        return !(swtSideConstant == SWT.LEFT || swtSideConstant == SWT.RIGHT);
    }
    /**
     * Moves the given rectangle by the given delta.
     * 
     * @param rect rectangle to move (will be modified)