Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Usage Clipboard object multiple times in SWT

Hello together,

if I run the following code in several Thread, but not in parallel, I can
access the clipboard object only for one time, even if a get a new Instance
on every new call:

	Clipboard cb = new Clipboard(Display.getCurrent());
	String textData = "Hello World !";
	TextTransfer textTransfer = TextTransfer.getInstance();
	cb.setContents(new Object[]{textData}, new Transfer[]{textTransfer});
	cb.dispose();

The error by calling on the second time looks like this:

org.eclipse.swt.SWTError: Cannot set data in clipboard
	at org.eclipse.swt.dnd.DND.error(DND.java:225)
	at org.eclipse.swt.dnd.DND.error(DND.java:181)
	at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:290)
	at
de.powerisdnmonitor.ui.swt.controls.CallerEditorControl$6.run(CallerEditorCo
ntrol.java:200)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:106)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2749)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2434)
	at
de.powerisdnmonitor.ui.swt.AbstractBaseComponent.show(AbstractBaseComponent.
java:118)
	at
de.powerisdnmonitor.ui.swt.AbstractCommandApplicationComponent.execute(Abstr
actCommandApplicationComponent.java:17)
	at
de.powerisdnmonitor.service.trayicon.TrayIcon$ActionHandler$HandlerThread.ru
n(TrayIcon.java:104)

Any ideas and help on this error is appreciated.

Best regards,
Thilo




Back to the top