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

Bug 358383

Summary: [Class Diagram] Class Cast Exception when trying to create an Association Class
Product: [Modeling] Papyrus Reporter: Camille Letavernier <cletavernier>
Component: CoreAssignee: Patrick Tessier <Patrick.Tessier>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Camille Letavernier CLA 2011-09-21 05:26:47 EDT
The following exception is thrown when trying to create an Association Class on an already existing Association :

java.lang.ClassCastException: org.eclipse.papyrus.diagram.clazz.edit.parts.AssociationEditPart cannot be cast to org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
	at org.eclipse.papyrus.diagram.clazz.custom.helper.AssociationClassHelper.getAssociationClassElementCommand(AssociationClassHelper.java:251)
	at org.eclipse.papyrus.diagram.clazz.custom.policies.CustomGraphicalNodeEditPolicy.getCommand(CustomGraphicalNodeEditPolicy.java:60)
	at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:502)
	[...]
	
	
There seems to be a confusion between GEF.GraphicalEditPart, GMF.IGraphicalEditPart and GMF.GraphicalEditPart, with unchecked, optimistic casts.
	
However, it is still possible to create an association class directly from two classes.

Steps to reproduce :

- Create two classes
- Create an association between these two classes
- Create an association class on the association

Workaround :

- Create two classes
- Create an association class between these two classes (Another exception is thrown, but this is another story, and this doesn't prevent the association class creation)
Comment 1 Patrick Tessier CLA 2012-07-06 11:29:55 EDT
Fixed in the version 8556

if this not a graphical editpart  unexecutableCommand is returned