3

I need to support file-drop into my Eclipse RCP application.

I've got file-drop support working, by defining the target UI element as a DropTarget. But, I only wish to allow users to drop in files of a particular file type (by suffix).

With FileTransfer type objects, the filename is contained in the event.data field, but this field is only populated in the drop() event, not in DragEnter or DragOver. I'd really like to give a visual feedback on unacceptable type during the drag, not after the item has been dropped.

Can anybody offer any pointers?

(I was investigating an extension of FileTransfer, but that has a protected constructor.)

cheers, Ian

1 Answer 1

2

This is platform specific. E.g event.dataTypes[].data contains required information on Windows. Check SWT Examples: determine data types available as a starting point.

Cheers, Max

3
  • Is it really platform specific? If I've got a FileTransfer object I'm sure it will have a filename (it's a list of Strings). My challenge is accessing the filename in a method other than drop().
    – ianmayo
    Aug 12, 2011 at 14:23
  • 2
    What I mean is that you COULD access filename in dragEnter, but only on win32 and probably motif.
    – Max
    Aug 12, 2011 at 22:29
  • Thanks for the clarification Max. Inevitably, I'm developing on OSX. As with any Java/Eclipse question, I should have made the platform clear. thanks again, Ian.
    – ianmayo
    Aug 15, 2011 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.