diff options
author | Adam Archer | 2009-02-05 15:36:11 +0000 |
---|---|---|
committer | Adam Archer | 2009-02-05 15:36:11 +0000 |
commit | 29295633ea7ae50e3432131ebe65d9b9ffea9d42 (patch) | |
tree | 12a0e3ca76008453ed986f914ae48732c08655fa /bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java | |
parent | 7ce9c497ea7c93bcb154babb4ac7af9eb6e2e058 (diff) | |
download | eclipse.platform.ui-29295633ea7ae50e3432131ebe65d9b9ffea9d42.tar.gz eclipse.platform.ui-29295633ea7ae50e3432131ebe65d9b9ffea9d42.tar.xz eclipse.platform.ui-29295633ea7ae50e3432131ebe65d9b9ffea9d42.zip |
Diffstat (limited to 'bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java')
-rw-r--r-- | bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java b/bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java index 62134562c4b..f0f4ea8049d 100644 --- a/bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java +++ b/bundles/org.eclipse.ui.forms/src/org/eclipse/ui/forms/widgets/ExpandableComposite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -270,9 +270,11 @@ public class ExpandableComposite extends Canvas { size = textLabelCache.computeSize(SWT.DEFAULT, SWT.DEFAULT); if (twidth < size.x + IGAP + tcsize.x) { twidth -= IGAP; - if (textLabel instanceof Label) - size = FormUtil.computeWrapSize(new GC(textLabel), ((Label)textLabel).getText(), Math.round(twidth*(size.x/(float)(size.x+tcsize.x)))); - else + if (textLabel instanceof Label) { + GC gc = new GC(textLabel); + size = FormUtil.computeWrapSize(gc, ((Label)textLabel).getText(), Math.round(twidth*(size.x/(float)(size.x+tcsize.x)))); + gc.dispose(); + } else size = textLabelCache.computeSize(Math.round(twidth*(size.x/(float)(size.x+tcsize.x))), SWT.DEFAULT); tcsize = textClientCache.computeSize(twidth-size.x, SWT.DEFAULT); } @@ -410,9 +412,11 @@ public class ExpandableComposite extends Canvas { size = textLabelCache.computeSize(SWT.DEFAULT, SWT.DEFAULT); if (innertHint != SWT.DEFAULT && innertHint < size.x + IGAP + tcsize.x) { innertHint -= IGAP; - if (textLabel instanceof Label) - size = FormUtil.computeWrapSize(new GC(textLabel), ((Label)textLabel).getText(), Math.round(innertHint*(size.x/(float)(size.x+tcsize.x)))); - else + if (textLabel instanceof Label) { + GC gc = new GC(textLabel); + size = FormUtil.computeWrapSize(gc, ((Label)textLabel).getText(), Math.round(innertHint*(size.x/(float)(size.x+tcsize.x)))); + gc.dispose(); + } else size = textLabelCache.computeSize(Math.round(innertHint*(size.x/(float)(size.x+tcsize.x))), SWT.DEFAULT); tcsize = textClientCache.computeSize(innertHint-size.x, SWT.DEFAULT); } |