Bug 544471: Layout data should not be reused in Widget factories
Re-add method layoutData(Object layoutData) that got lost during
rebasing of https://git.eclipse.org/r/#/c/137032/
Change-Id: I653e382d24dc0fba32b003d87885262ae0dc3061
Signed-off-by: Matthias Becker <ma.becker@sap.com>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/widgets/AbstractControlFactory.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/widgets/AbstractControlFactory.java
index f0e1772..6f0888f 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/widgets/AbstractControlFactory.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/widgets/AbstractControlFactory.java
@@ -68,7 +68,7 @@
* control needs its own unique layoutData.
*
* <p>
- *
+ *
* <pre>
* GridDataFactory gridDataFactory = GridDataFactory.fillDefaults().grab(true, false);
* ButtonFactory.newButton(SWT.PUSH).layoutData(gridDataFactory::create);
@@ -78,7 +78,7 @@
* or without GridDataFactory:
*
* <p>
- *
+ *
* <pre>
* ButtonFactory.newButton(SWT.PUSH).layoutData(() -> new GridData());
* </pre>
@@ -94,6 +94,26 @@
}
/**
+ * Sets a layout object, which is used for the setLayout method of the control.
+ *
+ * <p>
+ *
+ * <pre>
+ * GridData gd = new GridData(GridData.FILL_BOTH);
+ * ButtonFactory.newButton(SWT.PUSH).layoutData(gd);
+ * </pre>
+ * </p>
+ * </p>
+ *
+ * @param layoutData
+ * @return this
+ */
+ public F layoutData(Object layoutData) {
+ addProperty(c -> c.setLayoutData(layoutData));
+ return cast(this);
+ }
+
+ /**
* Sets the font.
*
* @param font