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

Bug 477205

Summary: ClassCastException ResizableLabelLocator / Rectangle when moving label of edge
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cedric.brun, error-reports-inbox, julien.dupont, laurent.redor, pierre-charles.david
Version: 1.0.0M6Keywords: triaged
Target Milestone: 3.0.2   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/55744
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=5f188ca0be9ec00fe810360d29fbeb8d3b9ba253
Whiteboard:
Bug Depends on: 430086    
Bug Blocks: 451053    

Description Pierre-Charles David CLA 2015-09-11 10:30:21 EDT
+++ This bug was initially created as a clone of Bug #430086 +++

When using EcoreTools 2 I sometime have a few ClassCastException being trown.

I don't have yet a perfectly reproductible scenario but it happens when I am moving edges (which have a rectilinear routing) to layout them.

java.lang.ClassCastException: org.eclipse.gmf.runtime.diagram.ui.internal.figures.ResizableLabelLocator cannot be cast to org.eclipse.draw2d.geometry.Rectangle
	at org.eclipse.gef.editpolicies.XYLayoutEditPolicy.getCurrentConstraintFor(XYLayoutEditPolicy.java:102)
	at org.eclipse.sirius.diagram.graphical.edit.policies.AirXYLayoutEditPolicy.getCurrentConstraintFor(AirXYLayoutEditPolicy.java:262)
	at org.eclipse.gef.editpolicies.XYLayoutEditPolicy.getConstraintFor(XYLayoutEditPolicy.java:55)
	at org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.getConstraintFor(ConstrainedLayoutEditPolicy.java:244)
	at org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy.getConstraintFor(XYLayoutEditPolicy.java:227)
	at org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.getAddCommand(ConstrainedLayoutEditPolicy.java:184)
	at org.eclipse.gef.editpolicies.LayoutEditPolicy.getCommand(LayoutEditPolicy.java:216)
	at org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.getCommand(ConstrainedLayoutEditPolicy.java:214)
	at org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy.getCommand(XYLayoutEditPolicy.java:329)
	at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:502)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$1(GraphicalEditPart.java:1)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$1.run(GraphicalEditPart.java:482)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(GraphicalEditPart.java:477)
	at org.eclipse.sirius.diagram.edit.api.part.AbstractDDiagramEditPart.getCommand(AbstractDDiagramEditPart.java:409)
	at org.eclipse.gef.tools.DragEditPartsTracker.getCommand(DragEditPartsTracker.java:281)
	at org.eclipse.gef.tools.DragEditPartsTracker.handleDragInProgress(DragEditPartsTracker.java:370)
	at org.eclipse.gef.tools.AbstractTool.mouseDrag(AbstractTool.java:1114)
	at org.eclipse.gef.tools.SelectionTool.mouseDrag(SelectionTool.java:538)
	at org.eclipse.gef.EditDomain.mouseDrag(EditDomain.java:259)
	at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseMoved(DomainEventDispatcher.java:363)
	at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove(LightweightSystem.java:543)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3562)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3186)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	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:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

May be you have enough to get going?
Comment 1 Pierre-Charles David CLA 2015-09-11 10:31:43 EDT
Cloned to backport the fix in 3.0.x
Comment 2 Eclipse Genie CLA 2015-09-11 10:32:49 EDT
New Gerrit change created: https://git.eclipse.org/r/55744
Comment 4 Pierre-Charles David CLA 2015-09-14 08:56:59 EDT
Fixed by 5f188ca0be9ec00fe810360d29fbeb8d3b9ba253.
Comment 5 Pierre-Charles David CLA 2015-09-15 08:07:24 EDT
Verified on 3.0.2rc1 (as much as it can be: I played with the scenario described in the original issue and did not see the error).
Comment 6 Pierre-Charles David CLA 2015-12-15 05:23:49 EST
Available in Sirius 3.0.2 released on 2015-09-15.