[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: LocalSelectionTransfer and clipboard

Try this instead:

clipboard.setContents(new Object[] {new StructuredSelection(selectedObject)},
new Transfer[] {LocalSelectionTransfer.getTransfer()});


The LocalSelectionTransfer expects to deal with an ISelection.

Then to get the contents, I use:

ISelection selection = LocalSelectionTransfer.getTransfer()
                        .getSelection();


Kerri wrote:
Is it ok to use LocalSelectionTransfer with the org.eclipse.swt.dnd.Clipboard?  I'm having a problem getting contents back from the clipboard so I wrote these 2 lines of code.  In the debugger I can see that the data is stored in the clipboard from the first line but I can't get it back out.

I have these 2 lines of code and the second one returns null.

clipboard.setContents(new Object[] {selectedObject}, new Transfer[] {LocalSelectionTransfer.getTransfer()});

Object lsObject = clipboard.getContents( LocalSelectionTransfer.getTransfer());



Thanks for any advice! Kerri