bug 123740: Provide shorthand for creating GridLayouts
Added copy() methods to simplify reusing factories
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridDataFactory.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridDataFactory.java
index 4888b7b..bb399c4 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridDataFactory.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridDataFactory.java
@@ -146,17 +146,6 @@
public static GridDataFactory createFrom(GridData data) {
return new GridDataFactory(copyData(data));
}
-
- /**
- * Creates a new GridDataFactory that creates copies of the given GridData
- * by default.
- *
- * @param data GridData to copy
- * @return a new GridDataFactory that creates copies of the argument by default
- */
- public static GridDataFactory createFrom(GridDataFactory data) {
- return new GridDataFactory(data.create());
- }
/**
* Creates a GridDataFactory initialized with defaults that will cause
@@ -370,6 +359,15 @@
}
/**
+ * Creates a copy of the reciever.
+ *
+ * @return a copy of the reciever
+ */
+ public GridDataFactory copy() {
+ return new GridDataFactory(create());
+ }
+
+ /**
* Returns a copy of the given GridData
*
* @param data GridData to copy
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridLayoutFactory.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridLayoutFactory.java
index 4147e2b..a2336a2 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridLayoutFactory.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/layout/GridLayoutFactory.java
@@ -66,13 +66,12 @@
}
/**
- * Copies an existing factory
+ * Creates a copy of the reciever.
*
- * @param f factory to copy
- * @return a copy of the argument
+ * @return a copy of the reciever
*/
- public static GridLayoutFactory createFrom(GridLayoutFactory f) {
- return new GridLayoutFactory(f.create());
+ public GridLayoutFactory copy() {
+ return new GridLayoutFactory(create());
}
/**