Bug 184345 [Forms] ColumnLayout calculates number of columns incorrectly
In package org.eclipse.ui.forms.widgets, class ColumnLayout, method layout, I believe the number of columns is calculated incorrectly. This can cause the columns to be considerably wider than they should be. The line is: int ncolumns = (carea.width - leftMargin - rightMargin - horizontalSpacing) / (cwidth + horizontalSpacing); I think it should be: int ncolumns = (carea.width - leftMargin - rightMargin + horizontalSpacing) / (cwidth + horizontalSpacing); because the horizontalSpacing is only between columns, and not also on the outsides of the columns. (i.e. There are only ncolumns-1 horizontalSpacing's.) The derivation is: ncolumns * cwidth + (ncolumns-1) * horizontalSpacing = carea.width - leftMargin - rightMargin ==> ncolumns * cwidth + ncolumns * horizontalSpacing = carea.width - leftMargin - rightMargin + horizontalSpacing ==> ncolumns * (cwidth + horizontalSpacing) = carea.width - leftMargin - rightMargin + horizontalSpacing
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ColumnLayout.java
child.setBounds(x + fillWidth - childWidth, topMargin+colHeight, childWidth, csize.y);
					break;
				case ColumnLayoutData.CENTER :
					child.setBounds(x + fillWidth / 2 - childWidth / 2, topMargin+colHeight, childWidth, csize.y);
					break;
			}
			
			colHeight += csize.y;
		}
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.forms.widgets.ILayoutExtension#computeMaximumWidth(org.eclipse.swt.widgets.Composite,
	 *      boolean)
	 */
	public int computeMaximumWidth(Composite parent, boolean changed) {
		return computeSize(parent, SWT.DEFAULT, SWT.DEFAULT, changed).x;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.forms.widgets.ILayoutExtension#computeMinimumWidth(org.eclipse.swt.widgets.Composite,
	 *      boolean)
	 */
	public int computeMinimumWidth(Composite parent, boolean changed) {
		return computeSize(parent, 0, SWT.DEFAULT, changed).x;
	}
}