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

Bug 500124

Summary: ClassCastException on semantic update
Product: [Modeling] Sirius Reporter: Maxime Porhel <maxime.porhel>
Component: DiagramAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: esteban.dugueperoux, florian.barbin, frederic.madiot, lengyela89, maxime.porhel, pierre-charles.david
Version: 3.1.0Keywords: triaged
Target Milestone: 4.0.1   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/79501
Whiteboard:
Bug Depends on: 485426    
Bug Blocks: 499928    

Description Maxime Porhel CLA 2016-08-23 08:34:26 EDT
+++ This bug was initially created as a clone of Bug #485426 +++

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 Maxime Porhel CLA 2016-08-23 08:36:22 EDT
See Bug 499928 for a reproduction case. 

The concrete stack is: 

Thread [ModalContext] (Suspended (exception ClassCastException))	
	owns: EcoreEditor$16  (id=275)	
	GMFHelper.getGraphicalEditPart(View) line: 646	
	GMFHelper.replaceAutoSize(Node, Rectangle, boolean, Dimension) line: 496	
	GMFHelper.getBounds(Node, boolean, boolean) line: 462	
	RegionContainerUpdateLayoutOperation.updateRegionsLayoutContraints(List<Node>, boolean) line: 115	
	RegionContainerUpdateLayoutOperation.execute() line: 97	
	DDiagramCanonicalSynchronizer.manageRegions() line: 142	
	DDiagramCanonicalSynchronizer.refreshSemantic() line: 126	
	DDiagramCanonicalSynchronizer.synchronize() line: 106	
	SynchronizeGMFModelCommand.doExecute() line: 44	
	SynchronizeGMFModelCommand(RecordingCommand).execute() line: 135	
	CompoundCommand.execute() line: 261	
	TriggerCommand.execute() line: 113	
	WorkspaceCommandStackImpl.executeTriggers(Command, List<Command>, Map<?,?>) line: 398	
	TransactionalEditingDomainImpl.precommit(InternalTransaction) line: 712	
	EMFOperationTransaction(TransactionImpl).commit() line: 414	
	EMFCommandOperation(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable) line: 155	
	DefaultOperationHistory.execute(IUndoableOperation, IProgressMonitor, IAdaptable) line: 488	
	WorkspaceCommandStackImpl.doExecute(Command, Map<?,?>) line: 208	
	WorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command, Map<?,?>) line: 165	
	WorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command) line: 219	
	RefreshEditorsPrecommitListener.notify(int) line: 282	
	DAnalysisSessionImpl.notifyListeners(int) line: 1019	
	SessionResourcesSynchronizer.reloadResource(Resource) line: 224	
	SessionResourcesSynchronizer.processAction(ReloadingPolicy$Action, Resource, IProgressMonitor) line: 170	
	SessionResourcesSynchronizer.processActions(List<Action>, Resource, IProgressMonitor) line: 159	
	SessionResourcesSynchronizer.statusesChanged(Collection<ResourceStatusChange>) line: 108	
	ResourceSetSync.notifyClientsInBatch(Collection<ResourceStatusChange>) line: 392	
	ResourceSetSync.statusesChanged(Collection<ResourceStatusChange>) line: 447	
	ResourceSyncClientNotifier.run(IProgressMonitor) line: 77	
	EditingSessionWorkspaceListener.resourceChanged(IResourceChangeEvent) line: 59	
	NotificationManager$1.run() line: 299	
	SafeRunner.run(ISafeRunnable) line: 42	
	NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], ResourceChangeEvent, boolean) line: 289	
	NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 152	
	Workspace.broadcastPostChange() line: 374	
	Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1469	
	Workspace.run(ICoreRunnable, ISchedulingRule, int, IProgressMonitor) line: 2253	
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2267	
	EcoreEditor$16(WorkspaceModifyOperation).run(IProgressMonitor) line: 128	
	ModalContext$ModalContextThread.run() line: 119
Comment 2 Eclipse Genie CLA 2016-08-23 08:37:12 EDT
New Gerrit change created: https://git.eclipse.org/r/79501
Comment 3 Maxime Porhel CLA 2016-08-24 08:22:23 EDT
Fixed by commit 3daed8cd358af35d0b8b8d0899fb5d152a202048 merged by Laurent Redor for Bug 499829.
Comment 4 Pierre-Charles David CLA 2016-11-04 10:15:35 EDT
Available in Sirius 4.0.1. See https://wiki.eclipse.org/Sirius/4.0.1.