Bug 435481 - ClassCastException in ActionMenuManager
Summary: ClassCastException in ActionMenuManager
Status: NEW
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-22 04:50 EDT by Maxime Porhel CLA
Modified: 2014-05-22 04:52 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 Maxime Porhel CLA 2014-05-22 04:50:39 EDT
I tried to add a menu in the edit contextual menu with org.eclipse.ui.menus extension point. 

I get a ClassCastException in org.eclipse.gmf.runtime.common.ui.action.ActionMenuManager line 69.

The event.widget.getData() is direclty casted in ActionContributionItem but with Luna and my extension, I get a org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem. 

I think you should at least check the data is a ActionContributionItem:
Object data = event.widget.getData();
if (data instanceof ActionContributionItem) {
 ActionContributionItem item = (ActionContributionItem) data;
   if (retargetLastAction) {
Comment 1 Maxime Porhel CLA 2014-05-22 04:52:09 EDT
The &Edit menu, with id editMenu has a org.eclipse.gmf.runtime.diagram.ui.actions.internal.EditMenuManagerwhich inherits from org.eclipse.gmf.runtime.common.ui.action.ActionMenuManager.