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

Bug 332016

Summary: [Profile] ClassCastException in context menu
Product: [Modeling] Papyrus Reporter: Camille Letavernier <cletavernier>
Component: CoreAssignee: Patrick Tessier <Patrick.Tessier>
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: Patrick.Tessier
Version: 0.7.1Flags: sebastien.gerard: indigo+
Target Milestone: M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Correction : Test added before cast rschnekenburger: iplog+

Description Camille Letavernier CLA 2010-12-07 08:51:29 EST
The AbstractViewActionDelegate#selectionChanged method does not test if the selected EObject is an UML Element before cast, which causes errors in some other contexts :

java.lang.ClassCastException: org.eclipse.papyrus.properties.contexts.impl.SectionImpl cannot be cast to org.eclipse.uml2.uml.Element
	at org.eclipse.papyrus.profile.ui.actions.AbstractViewActionDelegate.setSelectedElement(AbstractViewActionDelegate.java:94)
	at org.eclipse.papyrus.profile.ui.actions.AbstractViewActionDelegate.selectionChanged(AbstractViewActionDelegate.java:76)
	at org.eclipse.ui.internal.PluginAction.refreshEnablement(PluginAction.java:206)
	at org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:277)
	at org.eclipse.ui.internal.ObjectActionContributor$1.run(ObjectActionContributor.java:157)
	[...]
Comment 1 Camille Letavernier CLA 2010-12-07 08:54:06 EST
Created attachment 184717 [details]
Correction : Test added before cast
Comment 2 Patrick Tessier CLA 2011-07-28 05:31:50 EDT
Fix in the revision 5145 for the branch
a test has been added
Comment 3 Patrick Tessier CLA 2011-07-28 05:36:38 EDT
Merge has been done for the head revision 5146