1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| sash.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
Rectangle sashRect = sash.getBounds();
Rectangle shellRect = composite.getClientArea();
int right = shellRect.width - sashRect.width - limit;
e.x = Math.max(Math.min(e.x, right), limit);
if (e.x != sashRect.x) {
// move sash
sashData.left = new FormAttachment(0, e.x);
@SuppressWarnings("restriction")
CoolBarManager manager = ((WorkbenchWindow) workbenchWindow)
.getCoolBarManager();
Point compositeSize = composite.getSize();
Point size = getSize();
Point sizeParent = getParent().getSize();
Point resizeComposite = composite.computeSize(e.x + 5, 0);
Point resize = computeSize(size.x + (resizeComposite.x - compositeSize.x), 0);
Point resizeParent = computeSize(sizeParent.x + (resize.x - size.x), 0);
((FormData) ccombo.getLayoutData()).width = e.x;
getParent().setSize(resizeParent.x, sizeParent.y);
((GridData) getParent().getLayoutData()).widthHint = resizeParent.x;
setSize(resize.x, size.y);
((GridData) getLayoutData()).widthHint = resize.x;
manager.getControl().update();
manager.getControl().layout(true, true);
// manager.update(true);
}
}
}); |
Partager