Component architecture: creating a channel from an existing port to the parent component results in a ClassCastException
Steps to reproduce (see also attached screenshot)
- Create a Component architecture
- Add a new component (“C”)
- Add a new output port “p” to C
- Try to create a channel from “p” to the parent of “C” (i.e., the Component Architecture (“parent”)
- Observe below exception
Analysis
- Trying to create a connection from “C” to the Component Architecture
does not result in an exception. In this case,
org.fortiss.tooling.base.ui.editpart.command.ConnectCommand
is not triggered. In this case, the responsible compositor is theComponentConnectionCompositor
- I guess that the root of the bug is in
PortComponentConnectionCompositor
(or one of its base classes) who’scanConnect()
implementation erroneously returns true for the connection from “p” to “parent” - Alternatively, the problem could also be by in the target connector creation logic (or at least, this could provide a different way to fix this bug)
- Observe, that problem exists recursively, i.e. if “parent” is not the Component Architecture
!ENTRY org.eclipse.emf.common 2 0 2014-10-07 10:15:07.135
!MESSAGE An exception was ignored during command execution
!STACK 0
org.eclipse.emf.common.util.WrappedException: An exception was ignored during command execution
at org.eclipse.emf.common.command.BasicCommandStack.handleError(BasicCommandStack.java:281)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.handleError(AbstractTransactionalCommandStack.java:125)
at org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:112)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.basicExecute(AbstractTransactionalCommandStack.java:241)
at org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.doExecute(TransactionalCommandStackImpl.java:63)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.fortiss.tooling.kernel.internal.storage.eclipse.AutoUndoCommandStack.execute(AutoUndoCommandStack.java:84)
at org.fortiss.tooling.kernel.internal.storage.eclipse.ModelContext.runAsCommand(ModelContext.java:258)
at org.fortiss.tooling.base.ui.internal.command.GEF2ToolingKernelCommandStack.execute(GEF2ToolingKernelCommandStack.java:72)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTool.java:425)
at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:438)
at org.eclipse.gef.tools.AbstractConnectionCreationTool.handleCreateConnection(AbstractConnectionCreationTool.java:256)
at org.eclipse.gef.tools.ConnectionDragCreationTool.handleButtonUp(ConnectionDragCreationTool.java:63)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1200)
at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.java:574)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:301)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:380)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:548)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:220)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.fortiss.af3.rcapplication.AF3Application.start(AF3Application.java:48)
at org.eclipse.equinox.internal.apEclipseAppHandle.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:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.ClassCastException: java.lang.Object cannot be cast to org.eclipse.emf.ecore.EObject
at org.fortiss.tooling.base.ui.editpart.command.ConnectCommand.execute(ConnectCommand.java:73)
at org.fortiss.tooling.base.ui.internal.command.GEF2ToolingKernelCommandStack$1.run(GEF2ToolingKernelCommandStack.java:76)
at org.fortiss.tooling.kernel.internal.storage.eclipse.ModelContext$2.execute(ModelContext.java:267)
at org.fortiss.tooling.kernel.internal.storage.eclipse.EMFTransactionalCommand$1.doExecute(EMFTransactionalCommand.java:60)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.fortiss.tooling.kernel.internal.storage.eclipse.EMFTransactionalCommand$2.run(EMFTransactionalCommand.java:72)
at org.fortiss.tooling.kernel.internal.storage.eclipse.EMFTransactionalCommand.runInTransaction(EMFTransactionalCommand.java:104)
at org.fortiss.tooling.kernel.internal.storage.eclipse.EMFTransactionalCommand.execute(EMFTransactionalCommand.java:69)
at org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
... 43 more
(from redmine: issue id 2138, created on 2014-10-07, closed on 2015-01-29)