Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358383 - [Class Diagram] Class Cast Exception when trying to create an Association Class
Summary: [Class Diagram] Class Cast Exception when trying to create an Association Class
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Patrick Tessier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 05:26 EDT by Camille Letavernier CLA
Modified: 2012-07-06 11:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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