if (event.detail == SWT.DRAG) {  Rectangle area = getClientArea(); if (orientation == SWT.HORIZONTAL) { event.x = Math.min(Math.max(DRAG_MINIMUM, event.x), area.width - DRAG_MINIMUM); } else { event.y = Math.min(Math.max(DRAG_MINIMUM, event.y), area.height - DRAG_MINIMUM); } return; }
if (event.detail == SWT.DRAG) {  Rectangle area = getClientArea(); if (orientation == SWT.HORIZONTAL) { event.x = Math.min(Math.max(DRAG_MINIMUM, event.x), area.width - DRAG_MINIMUM - SASH_WIDTH); } else { event.y = Math.min(Math.max(DRAG_MINIMUM, event.y), area.height - DRAG_MINIMUM - SASH_WIDTH); } return; }
void onDragSash(Event event) {	if (event.detail == SWT.DRAG) {		// constrain feedback		Rectangle area = getClientArea();		if (orientation == SWT.HORIZONTAL) {			event.x = Math.min(Math.max(DRAG_MINIMUM, event.x), area.width - DRAG_MINIMUM);		} else {			event.y = Math.min(Math.max(DRAG_MINIMUM, event.y), area.height - DRAG_MINIMUM);		}		return;	}	Sash sash = (Sash)event.widget;	int sashIndex = -1;	for (int i= 0; i < sashes.length; i++) {		if (sashes[i] == sash) {			sashIndex = i;			break;		}	}	if (sashIndex == -1) return;	Control c1 = controls[sashIndex];	Control c2 = controls[sashIndex + 1];	Rectangle b1 = c1.getBounds();	Rectangle b2 = c2.getBounds();		Rectangle sashBounds = sash.getBounds();	Rectangle area = getClientArea();	if (orientation == SWT.HORIZONTAL) {		int shift = event.x - sashBounds.x;		b1.width += shift;		b2.x += shift;		b2.width -= shift;		if (b1.width < DRAG_MINIMUM || b2.width < DRAG_MINIMUM) {			return;		}		c1.setData(LAYOUT_RATIO, new Long((((long)b1.width << 16) + area.width - 1) / area.width));		c2.setData(LAYOUT_RATIO, new Long((((long)b2.width << 16) + area.width - 1) / area.width));			} else {		int shift = event.y - sashBounds.y;		b1.height += shift;		b2.y += shift;		b2.height -= shift;		if (b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM) {			return;		}		c1.setData(LAYOUT_RATIO, new Long((((long)b1.height << 16) + area.height - 1) / area.height));		c2.setData(LAYOUT_RATIO, new Long((((long)b2.height << 16) + area.height - 1) / area.height));	}		c1.setBounds(b1);	sash.setBounds(event.x, event.y, event.width, event.height);	c2.setBounds(b2);}