Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-12-19 11:45:12 +0000
committerEike Stepper2008-12-19 11:45:12 +0000
commit96a7f3967147f01f4f2c86372bd89c6a8c182d05 (patch)
tree85595f9331cf287d387c37e716a3c48cb3ff5d50
parent51c4b37f0d19e1423cb093ef7f59122e9af146e6 (diff)
downloadcdo-96a7f3967147f01f4f2c86372bd89c6a8c182d05.tar.gz
cdo-96a7f3967147f01f4f2c86372bd89c6a8c182d05.tar.xz
cdo-96a7f3967147f01f4f2c86372bd89c6a8c182d05.zip
[247281] [UI] Specifying new Decorator for CDOLabelProvider
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247281
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
index cadef498d0..2aef3f0ece 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
@@ -221,4 +221,32 @@ public final class UIUtil
gd.horizontalIndent = dec.getImage().getBounds().width;
}
}
+
+ /**
+ * Adds indentation to the control. if indent value is < 0, the control indentation is left unchanged.
+ *
+ * @since 2.0
+ */
+ public static void setIndentation(Control control, int horizontalIndent, int verticalIndent)
+ {
+ if (control == null)
+ {
+ throw new IllegalArgumentException("control == null");
+ }
+
+ Object data = control.getLayoutData();
+ if (data instanceof GridData)
+ {
+ GridData gd = (GridData)data;
+ if (verticalIndent >= 0)
+ {
+ gd.verticalIndent = verticalIndent;
+ }
+
+ if (horizontalIndent >= 0)
+ {
+ gd.horizontalIndent = horizontalIndent;
+ }
+ }
+ }
}

Back to the top