Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 161095 - [CommonNavigator] Drag and Drop of non IResource items causes FileTransfer to be created with null data
Summary: [CommonNavigator] Drag and Drop of non IResource items causes FileTransfer to...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: Francis Upton IV CLA
QA Contact:
URL:
Whiteboard: ready
Keywords:
Depends on:
Blocks: 194208
  Show dependency tree
 
Reported: 2006-10-16 13:02 EDT by Ying Chen CLA
Modified: 2011-03-04 10:40 EST (History)
10 users (show)

See Also:


Attachments
Proposed fix (643 bytes, patch)
2007-01-11 09:52 EST, Anton Leherbauer CLA
francisu: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ying Chen CLA 2006-10-16 13:02:25 EDT
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.
Comment 1 Anton Leherbauer CLA 2007-01-11 09:52:29 EST
Created attachment 56766 [details]
Proposed fix

This fix sets the DragSourceEvent.doit flag to false in case none of the drag assistants could set the drag data.
Comment 2 Martin Oberhuber CLA 2007-07-11 11:54:37 EDT
The patch looks simple enough and has been attached since Jan.2007.
Could this be addressed for Eclipse 3.4?
Comment 3 Michael D. Elder CLA 2007-07-11 13:11:38 EDT
I think this is reasonable for 3.4. 
Comment 4 Mike Wilson CLA 2008-06-09 10:49:12 EDT
Michael, did this get fixed? Please close or mark the target milestone appropriately.
Comment 5 Kevin McGuire CLA 2008-06-10 14:57:46 EDT
This is marked target milestone 3.4 but 3.4 is basically over and this doesn't look like a last minute fix candidate.  Moving to 3.5 but Michael please pick what you think is right.
Comment 6 Francis Upton IV CLA 2008-08-13 17:47:05 EDT
Boris, this one's ready to go, both Michael and I have looked at this patch and it's fine.  I want it to go into 3.4.1.  What's the procedure for checking stuff into 3.4.1?  I assume I will also need to put it into HEAD as well (for 3.5).  Anf I further assume there is no automated way to do both.
Comment 7 Francis Upton IV CLA 2008-08-14 21:47:57 EDT
Released to HEAD (35M2) and to R3_4_maintenance for 3.4.1
Comment 8 Francis Upton IV CLA 2008-09-01 03:35:19 EDT
Verified patch is applied in source to M20080827-2000, need to actually verify the steps using WST which will have to be done when there is a WST build available.
Comment 9 Francis Upton IV CLA 2008-09-16 09:54:17 EDT
*** Bug 247444 has been marked as a duplicate of this bug. ***
Comment 10 John Arthorne CLA 2008-10-06 22:06:17 EDT
Removing the iplog flag from the bug which seems to have been added in error. Adding the iplog flag on the bug itself flags every comment in the bug as a contribution. The attachment containing the fix has been marked with iplog+ flag which is correct.
Comment 11 Francis Upton IV CLA 2008-10-06 22:45:33 EDT
(In reply to comment #10)
> Removing the iplog flag from the bug which seems to have been added in error.
> Adding the iplog flag on the bug itself flags every comment in the bug as a
> contribution. The attachment containing the fix has been marked with iplog+
> flag which is correct.
> 
Is there anything you are no involved in? :)  Thanks!
Comment 12 John Arthorne CLA 2008-10-06 22:51:39 EDT
> Is there anything you are no involved in? :)  Thanks!

Just doing some light reading of the Eclipse IP log - isn't that how all committers like to spend their evenings? <g>