Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2020-07-07 07:16:34 +0000
committerKarsten Thoms2020-07-07 07:45:46 +0000
commit7a22fd0ddbc6c5d3f944c70f10a74b0986e48448 (patch)
tree9214758ad65f3b1b65533d85dfc4db4ea6a68920
parentf94d41435263be0491e2a957cf1501c08b6c2b27 (diff)
downloadeclipse.platform.swt-7a22fd0ddbc6c5d3f944c70f10a74b0986e48448.tar.gz
eclipse.platform.swt-7a22fd0ddbc6c5d3f944c70f10a74b0986e48448.tar.xz
eclipse.platform.swt-7a22fd0ddbc6c5d3f944c70f10a74b0986e48448.zip
Revert "Bug 513185 - FillLayout throws ClassCastExecption for children with"
This reverts commit 82a3f03bf35bac3c3cf3e449713cb672124f1ab1. Reason for revert: Causes regressions for widgets with implicit GridData layout data Change-Id: Ibb0bc2c83a40226367c902a3a5e055170eb32dce
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java28
1 files changed, 4 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java
index 250ccc24e9..f66f280bc8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,7 +10,6 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Christoph Läubrich - Bug 513185
*******************************************************************************/
package org.eclipse.swt.layout;
@@ -146,7 +145,7 @@ protected Point computeSize (Composite composite, int wHint, int hHint, boolean
}
Point computeChildSize (Control control, int wHint, int hHint, boolean flushCache) {
- FillData data = validateLayoutData(control, -1);
+ FillData data = (FillData)control.getLayoutData ();
if (data == null) {
data = new FillData ();
control.setLayoutData (data);
@@ -173,10 +172,8 @@ Point computeChildSize (Control control, int wHint, int hHint, boolean flushCach
@Override
protected boolean flushCache (Control control) {
- FillData data = validateLayoutData(control, -1);
- if (data != null) {
- data.flushCache();
- }
+ Object data = control.getLayoutData();
+ if (data != null) ((FillData)data).flushCache();
return true;
}
@@ -201,7 +198,6 @@ protected void layout (Composite composite, boolean flushCache) {
int y = rect.y + marginHeight, cellWidth = width / count;
for (int i=0; i<count; i++) {
Control child = children [i];
- validateLayoutData(child, i);
int childWidth = cellWidth;
if (i == 0) {
childWidth += extra / 2;
@@ -217,7 +213,6 @@ protected void layout (Composite composite, boolean flushCache) {
int y = rect.y + marginHeight, extra = height % count;
for (int i=0; i<count; i++) {
Control child = children [i];
- validateLayoutData(child, i);
int childHeight = cellHeight;
if (i == 0) {
childHeight += extra / 2;
@@ -230,21 +225,6 @@ protected void layout (Composite composite, boolean flushCache) {
}
}
-private FillData validateLayoutData(Control control, int index) {
- if (control == null) {
- throw new SWTException(SWT.ERROR_NULL_ARGUMENT, "control can't be null");
- }
- Object layoutData = control.getLayoutData();
- if (layoutData == null) {
- return null;
- }
- if (layoutData instanceof FillData) {
- return (FillData) layoutData;
- }
- throw new SWTException(SWT.ERROR_INVALID_ARGUMENT, "Child#" + index + " of type " + control.getClass().getName()
- + " has illegal layout data type " + layoutData.getClass().getName());
-}
-
/**
* Returns a string containing a concise, human-readable
* description of the receiver.

Back to the top