Project: Eclipse_Platform_UI
Bug 161095 [CommonNavigator] Drag and Drop of non IResource items causes FileTransfer to be created with null data
Reported: 2006-10-16 13:02:25 | Status: resolved fixed

I am not sure whether this is the right behavior or not. This is found when using this Project Explorer with an Editor that expects an FileTransfer (like SSE or Page Designer). A FileTransfer gets created on drag, but becuase the selection in the Project Explorer is not adapted to IResource, the constructed FileTransfer contains null . So, when Dnd an non IResource or IFile adapted item (such as Java Resources: src node) - onto the editor: 1. The Editor expects an FileTransfer. 2. When CommonDragAdapter - in dragSetData(event) code : - ResourceDragAdapterAssistant is used to match the FileTransfer - on setDragData method : IResource[] resources = getSelectedResources(aSelection); will return empty. 3. When Editor tries to retrieve the data from the FileTransfer : - SSE gets an ClassCasteException (because its expecting String[], but got an Object instead. - Page Designer gets and SWTException (from FileTransfer.nativeToJava() which calls FileTransfer.javaToNative (see that null will toss the invalid data exception) It seems that FileTransfer should not be created by the Project Explorer when Drag source is not an IResource adapted node.

Files changed in fix:
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonDragAdapter.java