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

Bug 485426

Summary: ClassCastException on semantic update
Product: [Modeling] Sirius Reporter: Esteban DUGUEPEROUX <esteban.dugueperoux>
Component: DiagramAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: normal    
Priority: P3 CC: florian.barbin, frederic.madiot, julien.dupont, lengyela89, maxime.porhel, pierre-charles.david
Version: 3.1.0Keywords: triaged
Target Milestone: 4.1.0   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/63855
https://git.eclipse.org/r/69321
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2ac89a3aecf989a2dd70b9ef27c1ed86e4b47735
Whiteboard:
Bug Depends on:    
Bug Blocks: 499928, 500124    
Attachments:
Description Flags
Sample project to reproduce none

Description Esteban DUGUEPEROUX CLA 2016-01-08 09:52:02 EST
I get the following exception on semantic update :

Caused by: java.lang.ClassCastException: test.aqlbug.aqlbug.presentation.AqlbugEditor cannot be cast to org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor
	at org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper.getGraphicalEditPart(GMFHelper.java:646)
	at org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper.replaceAutoSize(GMFHelper.java:496)
	at org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper.getBounds(GMFHelper.java:462)
	at org.eclipse.sirius.diagram.ui.internal.operation.RegionContainerUpdateLayoutOperation.updateRegionsLayoutContraints(RegionContainerUpdateLayoutOperation.java:115)
	at org.eclipse.sirius.diagram.ui.internal.operation.RegionContainerUpdateLayoutOperation.execute(RegionContainerUpdateLayoutOperation.java:97)
	at org.eclipse.sirius.diagram.ui.internal.operation.RegionContainerUpdateLayoutOperation.execute(RegionContainerUpdateLayoutOperation.java:1)
	at org.eclipse.sirius.diagram.ui.tools.internal.edit.command.CommandFactory$1.doExecuteWithResult(CommandFactory.java:110)
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.emf.workspace.CompositeEMFOperation.doExecute(CompositeEMFOperation.java:217)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy.execute(ICommandProxy.java:68)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy.doExecuteWithResult(CommandProxy.java:50)
	at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:134)
	at org.eclipse.emf.workspace.CompositeEMFOperation.doExecute(CompositeEMFOperation.java:217)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.gmf.runtime.diagram.ui.commands.ArrangeCommand.doExecuteWithResult(ArrangeCommand.java:95)
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.emf.workspace.CompositeEMFOperation.doExecute(CompositeEMFOperation.java:217)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.emf.workspace.CompositeEMFOperation.doExecute(CompositeEMFOperation.java:217)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.emf.workspace.CompositeEMFOperation.doExecute(CompositeEMFOperation.java:217)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand.doExecuteWithResult(DeferredLayoutCommand.java:200)
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy.execute(ICommandProxy.java:68)
	at org.eclipse.gef.commands.CompoundCommand.execute(CompoundCommand.java:129)
	at org.eclipse.sirius.diagram.ui.internal.refresh.layout.SiriusCanonicalLayoutCommand.executeLayoutDueToExternalChanges(SiriusCanonicalLayoutCommand.java:107)
	at org.eclipse.sirius.diagram.ui.internal.refresh.layout.SiriusCanonicalLayoutCommand.access$3(SiriusCanonicalLayoutCommand.java:104)
	at org.eclipse.sirius.diagram.ui.internal.refresh.layout.SiriusCanonicalLayoutCommand$1.run(SiriusCanonicalLayoutCommand.java:90)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
Comment 1 Esteban DUGUEPEROUX CLA 2016-01-08 10:00:00 EST
Created attachment 259082 [details]
Sample project to reproduce

I have no determinist scenario, sometimes I get it on odesign update.
Comment 2 Eclipse Genie CLA 2016-01-08 10:01:42 EST
New Gerrit change created: https://git.eclipse.org/r/63855
Comment 3 Pierre-Charles David CLA 2016-03-08 05:15:17 EST
*** Bug 489190 has been marked as a duplicate of this bug. ***
Comment 4 Adam Lengyel CLA 2016-03-08 09:41:00 EST
Hi,

I ran into the same problem in the following way:

I'm working on a Sirius diagram editor for the language of EMF-IncQuery (https://projects.eclipse.org/projects/modeling.incquery). This project has been merged to VIATRA project, but documentation for the language can be found here:
http://wiki.eclipse.org/VIATRA/Query/UserDocumentation/QueryLanguage

How I found the bug:
- I created a valid model with the XText Editor belongs to the EMF-IncQuery's language

- I created a Sirius diagram for this model, and opened it (until this point everything is fine)

(note that at this time I have an XText editor and a Sirius diagram opened at the same time on the same file)

- I modify the model with the XText editor (after the modification the model is valid), and save

- After that, the Sirius reloads the model, and refreshes the diagram. During this phase I get a ClassCastException, because the "editor" variable I mentioned in this (https://bugs.eclipse.org/bugs/show_bug.cgi?id=489190) bug refers to an XTextEditor.

Unfortunately I can't attach an example where you can check this bug currently, but as soon as possible I will send one.

Hope I could help you something.

Regards,
Adam
Comment 6 Pierre-Charles David CLA 2016-06-08 09:59:55 EDT
Probably fixed by 2ac89a3aecf989a2dd70b9ef27c1ed86e4b47735, but we don't have a reproduction scenario, so not closing for now.
Comment 7 Maxime Porhel CLA 2016-08-23 05:04:32 EDT
See Bug 499928 created by Fred. 

I reproduce the ClassCast on Sirius 4.0 but not with master for 4.1. 
I will not close Bug 499928 as duplicate but keep it for backport on 4.0.0.
Comment 8 Frederic Gurr CLA 2016-08-23 05:55:39 EDT
*** Bug 499928 has been marked as a duplicate of this bug. ***
Comment 9 Maxime Porhel CLA 2016-08-30 05:00:36 EDT
Resolved by commit 2ac89a3aecf989a2dd70b9ef27c1ed86e4b47735.
See Bug 499928 for reproduction/validation scenario
Comment 10 Pierre-Charles David CLA 2016-10-18 11:09:07 EDT
Available in Sirius 4.1.0, see https://wiki.eclipse.org/Sirius/4.1.0 for details.