Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-05-16 17:02:22 +0000
committerEike Stepper2011-05-16 17:02:22 +0000
commit941eec1e44e0f78971d8171ca2797ca569b2bd9c (patch)
treead3c36b46173c1a7c43968134fee44296b464ee8 /plugins/org.eclipse.net4j.util.ui
parent52b70d0941f5f71cf459d38fc79353fd444da4ce (diff)
downloadcdo-941eec1e44e0f78971d8171ca2797ca569b2bd9c.tar.gz
cdo-941eec1e44e0f78971d8171ca2797ca569b2bd9c.tar.xz
cdo-941eec1e44e0f78971d8171ca2797ca569b2bd9c.zip
[337870] Provide durable locking
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337870
Diffstat (limited to 'plugins/org.eclipse.net4j.util.ui')
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java24
1 files changed, 24 insertions, 0 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 4f169574fd..58e5abbcad 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
@@ -20,6 +20,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@@ -53,6 +56,27 @@ public final class UIUtil
{
}
+ /**
+ * @since 3.1
+ */
+ public static void copyToClipboard(Display display, String text)
+ {
+ Clipboard clipboard = null;
+
+ try
+ {
+ clipboard = new Clipboard(display);
+ clipboard.setContents(new Object[] { text }, new Transfer[] { TextTransfer.getInstance() });
+ }
+ finally
+ {
+ if (clipboard != null)
+ {
+ clipboard.dispose();
+ }
+ }
+ }
+
public static void dispose(Font font)
{
if (font != null)

Back to the top