Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325597 - ctrl drag causes error
Summary: ctrl drag causes error
Status: ASSIGNED
Alias: None
Product: AMP
Classification: Modeling
Component: Escape (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Miles Parker CLA
QA Contact: Miles Parker CLA
URL:
Whiteboard:
Keywords:
Depends on: 325535
Blocks:
  Show dependency tree
 
Reported: 2010-09-17 10:07 EDT by Rainer Hilscher CLA
Modified: 2010-09-21 12:56 EDT (History)
1 user (show)

See Also:


Attachments
source code based on tutorial that causes the problem (27.69 KB, application/octet-stream)
2010-09-17 10:11 EDT, Rainer Hilscher CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Hilscher CLA 2010-09-17 10:07:00 EDT
Build Identifier: 20100617-1415

ctrl drag causes "Unhandled event loop exception"

"eclipse.buildId=I20100608-0911
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product


Error
Fri Sep 17 09:55:08 EDT 2010
Unhandled event loop exception

java.lang.ClassCastException: java.util.Collections$SingletonSet cannot be cast to java.util.List
	at org.metaabm.act.provider.AActItemProvider.createActDragCommand(AActItemProvider.java:335)
	at org.metaabm.act.provider.AActItemProvider.createDragAndDropCommand(AActItemProvider.java:360)
	at org.eclipse.emf.edit.provider.ItemProviderAdapter.createCommand(ItemProviderAdapter.java:992)
	at org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.createCommand(AdapterFactoryEditingDomain.java:464)
	at org.eclipse.emf.edit.command.DragAndDropCommand.create(DragAndDropCommand.java:74)
	at org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter$DragAndDropCommandInformation.createCommand(EditingDomainViewerDropAdapter.java:487)
	at org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.helper(EditingDomainViewerDropAdapter.java:300)
	at org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.dragEnter(EditingDomainViewerDropAdapter.java:143)
	at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:60)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
	at org.eclipse.swt.dnd.DropTarget.DragEnter(DropTarget.java:297)
	at org.eclipse.swt.dnd.DropTarget$3.method3(DropTarget.java:243)
	at org.eclipse.swt.internal.ole.win32.COMObject.callback3(COMObject.java:92)
	at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
	at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:363)
	at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:289)
	at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:172)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)"

Reproducible: Always

Steps to Reproduce:
1.grab Intersection
2. start drag
3. press ctrl
Comment 1 Rainer Hilscher CLA 2010-09-17 10:11:08 EDT
Created attachment 179117 [details]
source code based on tutorial that causes the problem
Comment 2 Miles Parker CLA 2010-09-17 12:57:22 EDT
Hmm... I don't know what happened to my last submission. Anyway, I can't duplicate but I'm not on Windows XP so I wouldn't be able to anyway. Jonas, any chance you could take a look at this just to confirm that it is an issue?

Anyway, Ranier, please see related bug. There is indeed also a code generation issue.
Comment 3 Miles Parker CLA 2010-09-17 18:13:32 EDT
OK, two things based on inspection of the code.

1) I have put in a fix for an obvious issue revealed by the bug even though I haven't been able to reproduce the bug itself..it is not actually clear to me why this issue isn't showing up elsewhere. To test it, you'll need to get the latest build, which unfortunately isn't available because the Eclipse build server is down. :) But that should be resolved soon, I hope..

2) The code you're in is actually for a drag copy, not a drag link. So I realized that I actually am giving you the wrong key combo to use! I don't know why it worked for me before. You should be using "Ctrl-Shift" which is the Windows key combo for that. Apparently, at least according to this:

http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html#_dt51C

"The dragOperationChanged event occurs when the user presses or releases a modifier key (such as Ctrl, Shift, Command, Option). The modifier keys are used to switch the operation to be performed. For example, on Windows when just the Ctrl key is down, a copy is requested, when the Ctrl and Shift keys are both down, a link is requested and when just the Shift key is down, a move is requested. When no modifier keys are pressed, the default operation is requested. See the dragEnter event for more details."

Ctrl is actually for copy, which makes no sense given issue with mapping to right-mouse click. I thought that that was the alt key, but you can tell I'm not a Windows user.. :)
Comment 4 Rainer Hilscher CLA 2010-09-17 22:12:20 EDT
Miles, I just updated AMP with http://download.eclipse.org/amp/updates/nightly and I am still getting this code generation error in method "bugRule" ... this bug (no pun intended) consistently shows up the moment I assign an input variable (Bug Vision) ... not when I create the "Within" query.

Rainer


> OK, two things based on inspection of the code.
> 
> 1) I have put in a fix for an obvious issue revealed by the bug even though I
> haven't been able to reproduce the bug itself..it is not actually clear to me
> why this issue isn't showing up elsewhere. To test it, you'll need to get the
> latest build, which unfortunately isn't available because the Eclipse build
> server is down. :) But that should be resolved soon, I hope..
> 
> 2) The code you're in is actually for a drag copy, not a drag link. So I
> realized that I actually am giving you the wrong key combo to use! I don't know
> why it worked for me before. You should be using "Ctrl-Shift" which is the
> Windows key combo for that. Apparently, at least according to this:
> 
> http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html#_dt51C
> 
> "The dragOperationChanged event occurs when the user presses or releases a
> modifier key (such as Ctrl, Shift, Command, Option). The modifier keys are used
> to switch the operation to be performed. For example, on Windows when just the
> Ctrl key is down, a copy is requested, when the Ctrl and Shift keys are both
> down, a link is requested and when just the Shift key is down, a move is
> requested. When no modifier keys are pressed, the default operation is
> requested. See the dragEnter event for more details."
> 
> Ctrl is actually for copy, which makes no sense given issue with mapping to
> right-mouse click. I thought that that was the alt key, but you can tell I'm
> not a Windows user.. :)
Comment 5 Miles Parker CLA 2010-09-18 10:55:12 EDT
(In reply to comment #4)
> Miles, I just updated AMP with http://download.eclipse.org/amp/updates/nightly
> and I am still getting this code generation error in method "bugRule" ... this
> bug (no pun intended) consistently shows up the moment I assign an input
> variable (Bug Vision) ... not when I create the "Within" query.
> 

Hi Ranier,

Yes -- the Eclipse build server actually died. As in the hardware failed. :O So we'll have to wait to try the fix until they put a new machine in. In the meantime, please see the workaround in the code gen (ahem) bug.
Comment 6 Miles Parker CLA 2010-09-18 10:56:08 EDT
Oh, in case it wasn't clear that's bug 325628
Comment 7 Jonas Ruttimann CLA 2010-09-20 02:23:13 EDT
(In reply to comment #2)

Hi Miles,
Meanwhile I've switched to Windows 7. But I was still able to reproduce the Bug by dragging a Query and pressing CTRL:

!ENTRY org.eclipse.ui 4 0 2010-09-20 08:21:11.885
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.ClassCastException: java.util.Collections$SingletonSet cannot be cast to java.util.List
	at org.metaabm.act.provider.AActItemProvider.createActDragCommand(AActItemProvider.java:335)
	at org.metaabm.act.provider.AActItemProvider.createDragAndDropCommand(AActItemProvider.java:360)
	at org.eclipse.emf.edit.provider.ItemProviderAdapter.createCommand(ItemProviderAdapter.java:992)
	at org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.createCommand(AdapterFactoryEditingDomain.java:464)
	at org.eclipse.emf.edit.command.DragAndDropCommand.create(DragAndDropCommand.java:74)
	at org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter$DragAndDropCommandInformation.createCommand(EditingDomainViewerDropAdapter.java:487)
	at org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.helper(EditingDomainViewerDropAdapter.java:323)
	at org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.dragOperationChanged(EditingDomainViewerDropAdapter.java:181)
	at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:110)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:104)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1087)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1072)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:785)
	at org.eclipse.swt.dnd.DropTarget.DragOver(DropTarget.java:370)
	at org.eclipse.swt.dnd.DropTarget$3.method4(DropTarget.java:254)
	at org.eclipse.swt.internal.ole.win32.COMObject.callback4(COMObject.java:101)
	at org.eclipse.swt.internal.ole.win32.COM.DoDragDrop(Native Method)
	at org.eclipse.swt.dnd.DragSource.drag(DragSource.java:367)
	at org.eclipse.swt.dnd.DragSource.access$0(DragSource.java:103)
	at org.eclipse.swt.dnd.DragSource$1.handleEvent(DragSource.java:173)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:104)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5574)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:5151)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 8 Miles Parker CLA 2010-09-20 13:44:09 EDT
Thanks Jonas,

Eclipse build is still down so we can't get the fix to Ranier to test. But if you have the development environment from CVS could you launch runtime and confirm that the change I made fixes this behavior?
Comment 9 Jonas Ruttimann CLA 2010-09-21 05:58:29 EDT
(In reply to comment #8)

Yes, your fix works! CTRL does not lead to an Exception. This I can confirm.

When dragging a Set or an Intersection and pressing CTRL at the same time, lots and lots of copies are being added to the model. This is hardly controllable for the user. So I think this still needs to be optimized. (using Windows 7)

Will you stay on this, Miles? Should we open another bug for that and set this one to resolved?
Comment 10 Miles Parker CLA 2010-09-21 12:56:36 EDT
(In reply to comment #9)
> (In reply to comment #8)
> 
> Yes, your fix works! CTRL does not lead to an Exception. This I can confirm.
> 
> When dragging a Set or an Intersection and pressing CTRL at the same time, lots
> and lots of copies are being added to the model. This is hardly controllable
> for the user. So I think this still needs to be optimized. (using Windows 7)
> 
> Will you stay on this, Miles? Should we open another bug for that and set this
> one to resolved?

Let's open another bug if you think it is after we go through logic. There are two possibilities here -- one is that were simply running the wrong logic for copy now. I say that because if we reached this code before it seems that we should have had the same error. The second is that the functionality is not idea. The third is that everything is as intended. :)

Intention: I'm not sure what you mean by "lot's and lot's" -- but it should be a deep copy for the copied node and all target nodes...it has to be because otherwise you could easily get into a confusing situation where you've added a bunch of new sources for a target that you didn't intend to. Better to copy the whole tree instead. In practice, I'd think that copy would be used somewhat infrequently.

I am thinking that there might be an issue with ids though. You should never have the same ID reused for a model entity so if there are that would be a bug as well.