Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339345

Summary: ClassCast exception when drop target is List
Product: [Eclipse Project] Platform Reporter: Lakshmi P Shanmugam <lshanmug>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3    
Version: 3.7   
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
patch
none
fix none

Description Lakshmi P Shanmugam CLA 2011-03-09 07:54:44 EST
Happens on Cocoa with 3.7 HEAD

Run the DNDExample. Drag and drop to a the List as drop target.
We get class cast exception.

Exception in thread "main" java.lang.ClassCastException: org.eclipse.swt.widgets.List cannot be cast to org.eclipse.swt.widgets.Table
	at org.eclipse.swt.dnd.DropTarget.tableView_validateDrop_proposedRow_proposedDropOperation(DropTarget.java:965)
	at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.java:475)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.dnd.DropTarget.dndCallSuper(DropTarget.java:208)
	at org.eclipse.swt.dnd.DropTarget.draggingEntered(DropTarget.java:270)
	at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.java:448)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.mouseDownSuper(Widget.java:1081)
	at org.eclipse.swt.widgets.Table.mouseDownSuper(Table.java:1979)
	at org.eclipse.swt.widgets.Widget.mouseDown(Widget.java:1073)
	at org.eclipse.swt.widgets.Control.mouseDown(Control.java:2494)
	at org.eclipse.swt.widgets.Table.mouseDown(Table.java:1951)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5453)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2082)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2243)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5517)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4971)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5120)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3596)
	at org.eclipse.swt.examples.dnd.DNDExample.open(DNDExample.java:1352)
	at org.eclipse.swt.examples.dnd.DNDExample.main(DNDExample.java:71)
Comment 1 Lakshmi P Shanmugam CLA 2011-03-09 07:56:03 EST
Created attachment 190750 [details]
patch
Comment 2 Lakshmi P Shanmugam CLA 2011-03-09 08:11:49 EST
Fix for Bug 335172 missed out the check before type-casting.
The drop feedback doesn't work for List currently, but that seems like a different bug. (Need to investigate further...)
Silenio, can you please review for M6?
Comment 3 Silenio Quarti CLA 2011-03-09 11:56:34 EST
Created attachment 190775 [details]
fix

This patch uses OS calls to do the work. No need to cast.
Comment 4 Silenio Quarti CLA 2011-03-09 11:59:04 EST
Fixed > 20110309.

Lakshmi, please give it a try.