[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: copy files to Clipboard

You can set multiple types of data on the clipboard simultaneously,
therefore the method setContents expects an array of  data objects plus an
array of their transfer types. The FileTransfer data also happens to be an
array.  You are missing the first level of Object[].  This is hard to
explain in words but see the code below:

Clipboard cb = new Clipboard(display);
cb.setContents(new Object[] {new String[] {"myfile.txt"}},
                        new Transfer[] {FileTransfer.getInstance()});
System.out.println("cb=" +
((String[])cb.getContents(FileTransfer.getInstance()))[0]);
cb.dispose();