+ /*
+ * LAYOUT INDEPENDENT
+ */
+ /** Takes the most space possible, depending on parent layout. */
+ public static void fill(Control control) {
+ Layout parentLayout = control.getParent().getLayout();
+ if (parentLayout == null)
+ throw new IllegalStateException("Parent layout is not set");
+ if (parentLayout instanceof GridLayout) {
+ control.setLayoutData(fillAll());
+ } else if (parentLayout instanceof FormLayout) {
+ control.setLayoutData(coverAll());
+ } else {
+ throw new IllegalArgumentException("Unsupported parent layout " + parentLayout.getClass().getName());
+ }
+ }
+