Community
Participate
Working Groups
I'm using eclipse 3.6M3 and RAP 1.3M4. I'm doing a POC to convert an existing RCP application to RAP. The drag and drop feature works well when I drag elements from a view and drop them to an other view but it doesn't work when I drop them to an editor. The code responsible of drop is the same in the view and the editor. Table t = new Table(parent, SWT.NONE); TableViewer tViewer = new TableViewer(t); tViewer.addDropSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { ObjectTransfer.getInstance() }, new DefaultDropTargetListener()); And I get the following exception: java.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.swt.internal.widgets.displaykit.DNDSupport.proce ssDragEnter(DNDSupport.java:161) at org.eclipse.swt.internal.widgets.displaykit.DNDSupport.acces s$3(DNDSupport.java:147) at org.eclipse.swt.internal.widgets.displaykit.DNDSupport$1.run (DNDSupport.java:119) at org.eclipse.rwt.lifecycle.ProcessActionRunner.executeNext(Pr ocessActionRunner.java:57) at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.readAndDispa tch(RWTLifeCycle.java:238) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :982 To reproduce it, create a view with a viewer on a tree. Add a drag support on the treeViwer: viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setInput(createDummyModel()); viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] { ObjectTransfer.getInstance() }, new DefaultDragSourceListener()); Create an editor with a tableViewer associated to a table: Table t = new Table(parent, SWT.NONE); TableViewer tViewer = new TableViewer(t); tViewer.addDropSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { ObjectTransfer.getInstance() }, new DefaultDropTargetListener()); Try to drag element on the tree and drop them in the table of editor. This corrections is critical for us because it will prvent us to use RAP technology as we use Drag and Drop. Regards,
Created attachment 155764 [details] fix The described scenario resulted in a dropTarget being a child of another dropTarget. Both received the events dispatched by DragAndDropHandler, causing an inconsistent state in DNDSupport.js. Solved by calling event.stopPropagation(). Test included.
Applied patch to CVS HEAD