Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Clipboard problem on Windows
Clipboard problem on Windows [message #555438] Thu, 26 August 2010 15:19 Go to next message
Mattias Andersson is currently offline Mattias AnderssonFriend
Messages: 19
Registered: June 2010
Junior Member
Hi all,

I have a RCP app that basically is a Wizard. I get the following stack trace when I try to submit anything to the clipboard:

org.eclipse.swt.SWTError: Cannot set data in clipboard
at org.eclipse.swt.dnd.DND.error(DND.java:271)
at org.eclipse.swt.dnd.DND.error(DND.java:227)
at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:510 )
at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:411 )
at MyApp.ChangeSetView.copyToClipboard(ChangeSetView.java:141)

I use the Clipboard in a TreeViewer, the funny thing is that I also have a simple app for testing that only includes the same TreeViewer and it works fine. If I mark some text in a Text widget I can copy that text in my original application.

The OLE call:

int result = COM.OleSetClipboard(iDataObject.getAddress());

in Clipboard#setContents return -2147221008 which means (According to WINERROR.H)
-2147221008 (800401F0) CoInitialize has not been called.


protected void copyToClipboard() {
if (clipboard == null) {
clipboard = new Clipboard(getDisplay());
}

String selection = getSelection();
if (selection.length() == 0) {
clipboard.clearContents();
} else {
clipboard.setContents(new Object[] {selection},
new Transfer[] { TextTransfer.getInstance() });
}
}

I use Eclipse 3.6, the application work well on Solaris.

Any thoughts?
Re: Clipboard problem on Windows [message #555952 is a reply to message #555438] Mon, 30 August 2010 11:18 Go to previous messageGo to next message
Lakshmi ShanmugamFriend
Messages: 275
Registered: July 2009
Location: India
Senior Member
Hi,

Can you extract a testcase from your application to reproduce the problem? If so, then I would suggest opening a bug report with swt ( https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT ) so that the problem can be investigated.

Thanks,


Lakshmi P Shanmugam
Re: Clipboard problem on Windows [message #556487 is a reply to message #555952] Wed, 01 September 2010 14:43 Go to previous message
Mattias Andersson is currently offline Mattias AnderssonFriend
Messages: 19
Registered: June 2010
Junior Member
The problem is related to another COM call. I use Jacob (http://sourceforge.net/projects/jacob-project) to talk to another COM object. If I call Dispatch after the Display is created I get the clipboard problem, if I create the Display before the creation of the Display object it works fine.

The reason why I like to create the Display late is that I want to check some command line argument. If they fail I don't bother to create the Display.



public class Application implements IApplication {

public Object start(IApplicationContext context) throws Exception {
Dispatch sControl = new Dispatch("Word.Application");

final Display display = new Display();

try {
WizardDialog dlg = new WizardDialog(null, new WizardExample());
dlg.open();
} finally {
display.dispose();
}
return IApplication.EXIT_OK;
}

public void stop() {
}
}



Is it a usage, SWT or Jacob problem?

/Mattias
Previous Topic:Forcr UI update
Next Topic:Use of Display.addFilter() in practice
Goto Forum:
  


Current Time: Thu Oct 19 12:49:23 GMT 2017

Powered by FUDForum. Page generated in 0.01858 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software