From 9026a86b983ee8d99ce90a88c78d6d37d7877eec Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Fri, 27 Mar 2015 14:51:17 +0000 Subject: [PATCH] Add some utilities to eclipse UI Utils to ease UI implementation. git-svn-id: https://svn.argeo.org/commons/trunk@8043 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org/argeo/eclipse/ui/EclipseUiUtils.java | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/EclipseUiUtils.java b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/EclipseUiUtils.java index 06f569dce..2a17d285c 100644 --- a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/EclipseUiUtils.java +++ b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/EclipseUiUtils.java @@ -19,6 +19,8 @@ import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -27,8 +29,7 @@ import org.eclipse.swt.widgets.Text; /** Utilities to simplify UI development. */ public class EclipseUiUtils { - - + // // Simplify grid layouts management // @@ -58,13 +59,26 @@ public class EclipseUiUtils { false); } - - - - + // + // Simplify Form layout management + // + /** - * Create a label and a text field for a grid layout, the text field grabbing - * excess horizontal + * Creates a basic form data that is attached to the 4 corners of the parent + * composite + */ + public static FormData fillFormData() { + FormData formData = new FormData(); + formData.top = new FormAttachment(0, 0); + formData.left = new FormAttachment(0, 0); + formData.right = new FormAttachment(100, 0); + formData.bottom = new FormAttachment(100, 0); + return formData; + } + + /** + * Create a label and a text field for a grid layout, the text field + * grabbing excess horizontal * * @param parent * the parent composite @@ -127,6 +141,10 @@ public class EclipseUiUtils { return txt; } + // + // FONTS + // + /** Shortcut to retrieve default italic font from display */ public static Font getItalicFont(Composite parent) { return JFaceResources.getFontRegistry().defaultFontDescriptor() -- 2.30.2