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

Bug 230946

Summary: ClassCastException when working with GMF popup menus
Product: [Modeling] GMF-Runtime Reporter: Anthony Hunter <ahunter.eclipse>
Component: GeneralAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Anthony Hunter CLA 2008-05-07 13:40:21 EDT
When a popup menu closes, you get ClassCastException in the log. As a result of the exception, you may have to click twice to get operations to work.

The issue was a result the change in Bug 224682

The exception looks like:

!ENTRY org.eclipse.ui 4 0 2008-05-07 13:32:27.840
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ClassCastException: org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager incompatible with org.eclipse.jface.action.ContributionManager)
	at org.eclipse.swt.SWT.error(SWT.java:3773)
	at org.eclipse.swt.SWT.error(SWT.java:3691)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3759)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3384)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2394)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2358)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2210)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:494)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:489)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:112)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.ClassCastException: org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider$PluginMenuManager incompatible with org.eclipse.jface.action.ContributionManager
	at org.eclipse.ui.internal.PopupMenuExtender.sweepContributions(PopupMenuExtender.java:412)
	at org.eclipse.ui.internal.PopupMenuExtender.access$1(PopupMenuExtender.java:398)
	at org.eclipse.ui.internal.PopupMenuExtender$2.run(PopupMenuExtender.java:383)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	... 23 more
Comment 1 Anthony Hunter CLA 2008-05-07 21:05:31 EDT
Eric suggested:

private class PluginMenuManager
        extends MenuManager {

And that solves the problem.
Comment 2 Richard Gronback CLA 2008-08-13 13:09:33 EDT
[target cleanup] 2.1 M7 was the original target milestone for this bug
Comment 3 Eclipse Webmaster CLA 2010-07-19 21:58:19 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime was the original product and component for this bug