Bug 391957 - [Contributions] ClassCastException with action sets: OpaqueToolItemImpl cannot be cast to MTrimElement
Summary: [Contributions] ClassCastException with action sets: OpaqueToolItemImpl canno...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.2.1   Edit
Hardware: All All
: P3 major with 5 votes (vote)
Target Milestone: 4.2.2+   Edit
Assignee: Daniel Rolka CLA
QA Contact: Daniel Rolka CLA
URL:
Whiteboard: candidate43
Keywords:
Depends on:
Blocks: 420956
  Show dependency tree
 
Reported: 2012-10-15 13:09 EDT by Peter Severin CLA
Modified: 2018-01-11 03:47 EST (History)
6 users (show)

See Also:


Attachments
Test-case plugin (165.72 KB, application/zip)
2012-12-08 09:20 EST, Peter Severin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Severin CLA 2012-10-15 13:09:43 EDT
I have a plugin that uses Eclipse 3.x API. This plugin contributes a perspective. When I try to customize this perspective in Eclipse 4.2.1 using *Window > Customize Perspective...* nothing happens and an error gets logged.

You can reproduce this error by following these steps:
* Get a clean install of Eclipse 4.2.1
* Install WireframeSketcher plugin from http://wireframesketcher.com/updates
* Open *Sketching* perspective and try to customize it

Here's the stacktrace:

!MESSAGE java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.menu.impl.OpaqueToolItemImpl cannot be cast to org.eclipse.e4.ui.model.application.ui.basic.MTrimElement
!STACK 0
java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.menu.impl.OpaqueToolItemImpl cannot be cast to org.eclipse.e4.ui.model.application.ui.basic.MTrimElement
	at org.eclipse.ui.internal.CoolBarToTrimManager.find(CoolBarToTrimManager.java:266)
	at org.eclipse.ui.internal.WorkbenchWindowConfigurer$WindowActionBarConfigurer.containsCoolItem(WorkbenchWindowConfigurer.java:180)
	at org.eclipse.ui.internal.WorkbenchWindowConfigurer.containsCoolItem(WorkbenchWindowConfigurer.java:501)
	at org.eclipse.ui.internal.WorkbenchWindow.isWorkbenchCoolItemId(WorkbenchWindow.java:1549)
	at org.eclipse.ui.internal.PluginActionSetBuilder$ActionSetContribution.isValidCoolItemId(PluginActionSetBuilder.java:488)
	at org.eclipse.ui.internal.PluginActionSetBuilder$ActionSetContribution.contributeCoolbarAction(PluginActionSetBuilder.java:448)
	at org.eclipse.ui.internal.PluginActionSetBuilder$ActionSetContribution.contribute(PluginActionSetBuilder.java:376)
	at org.eclipse.ui.internal.PluginActionSetBuilder.buildMenuAndToolBarStructure(PluginActionSetBuilder.java:99)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog.buildMenusAndToolbarsFor(CustomizePerspectiveDialog.java:2718)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog.loadMenuAndToolbarStructure(CustomizePerspectiveDialog.java:2670)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog.<init>(CustomizePerspectiveDialog.java:1483)
	at org.eclipse.ui.internal.WorkbenchWindow.createCustomizePerspectiveDialog(WorkbenchWindow.java:2569)
	at org.eclipse.ui.internal.WorkbenchPage.editActionSets(WorkbenchPage.java:1882)
	at org.eclipse.ui.internal.handlers.EditActionSetsHandler.execute(EditActionSetsHandler.java:41)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
	at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:500)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3554)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3179)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Comment 1 Peter Severin CLA 2012-12-08 04:35:49 EST
After some tests I encountered the same error in another context. This time it happens during normal usage. My plugin contributes to menus and toolbars via action sets. The result is that both menus and toolbars get all messed up, with lots of entries missing. This makes the plugin unusable with Eclipse 4.2. I tested with the 4.2.2.

Could this be fixed for 4.2.x version?

Here's the stacktrace:

org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.menu.impl.OpaqueToolItemImpl cannot be cast to org.eclipse.e4.ui.model.application.ui.basic.MTrimElement
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:859)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:81)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.inject(ContextInjectionFactory.java:72)
	at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1252)
	at org.eclipse.ui.internal.Workbench.openWorkbenchWindow(Workbench.java:2324)
	at org.eclipse.ui.internal.Workbench.getWorkbenchPage(Workbench.java:1737)
	at org.eclipse.ui.internal.Workbench.setReference(Workbench.java:1756)
	at org.eclipse.ui.internal.Workbench.access$22(Workbench.java:1753)
	at org.eclipse.ui.internal.Workbench$33.handleEvent(Workbench.java:1693)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4291)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl.setContext(PartImpl.java:399)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:609)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:518)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:503)
	at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.createWidget(ElementReferenceRenderer.java:74)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1114)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:98)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:646)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:642)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:642)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:642)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:642)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:103)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:98)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:77)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:646)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:642)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:59)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:639)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:642)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:968)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.menu.impl.OpaqueToolItemImpl cannot be cast to org.eclipse.e4.ui.model.application.ui.basic.MTrimElement
	at org.eclipse.ui.internal.CoolBarToTrimManager.find(CoolBarToTrimManager.java:266)
	at org.eclipse.ui.internal.WorkbenchWindowConfigurer$WindowActionBarConfigurer.containsCoolItem(WorkbenchWindowConfigurer.java:180)
	at org.eclipse.ui.internal.WorkbenchWindowConfigurer.containsCoolItem(WorkbenchWindowConfigurer.java:501)
	at org.eclipse.ui.internal.WorkbenchWindow.isWorkbenchCoolItemId(WorkbenchWindow.java:1549)
	at org.eclipse.ui.internal.PluginActionSetBuilder$ActionSetContribution.isValidCoolItemId(PluginActionSetBuilder.java:488)
	at org.eclipse.ui.internal.PluginActionSetBuilder$ActionSetContribution.contributeCoolbarAction(PluginActionSetBuilder.java:448)
	at org.eclipse.ui.internal.PluginActionSetBuilder$ActionSetContribution.contribute(PluginActionSetBuilder.java:376)
	at org.eclipse.ui.internal.PluginActionSetBuilder.readActionExtensions(PluginActionSetBuilder.java:279)
	at org.eclipse.ui.internal.PluginActionSetBuilder.processActionSets(PluginActionSetBuilder.java:230)
	at org.eclipse.ui.internal.ActionPresentation.setActionSets(ActionPresentation.java:184)
	at org.eclipse.ui.internal.WorkbenchWindow.updateActionSets(WorkbenchWindow.java:1882)
	at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:623)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 123 more
Comment 2 Peter Severin CLA 2012-12-08 05:04:06 EST
It should have been Eclipse 4.2.1 in my previous comment.

Another observation. When testing with a clean instance of Eclipse SDK the issue is not visible on the first run. It happens starting with second run.
Comment 3 Paul Webster CLA 2012-12-08 06:37:29 EST
Can you attach a small plugin that reproduces the problem?

PW
Comment 4 Peter Severin CLA 2012-12-08 09:20:39 EST
Created attachment 224488 [details]
Test-case plugin
Comment 5 Peter Severin CLA 2012-12-08 09:25:24 EST
After some debugging I found the cause of the issue. I modified one of GEF examples to show the issue. The issue is with a toolbarPart that was missing a groupId (the part after /). Here's the snippet with action set declaration:

      <actionSet
            id="logic.actionSet2"
            label="Logic Action Set 2">
         <menu
               id="object"
               label="&amp;Object"
               path="navigate">
            <separator
                  name="inc">
            </separator>
         </menu>
         <action
               definitionId="Increment"
               icon="src/org/eclipse/gef/examples/logicdesigner/icons/plus.gif"
               id="Increment"
               label="Increment"
               menubarPath="object/inc"
               retarget="true"
               style="push"
               toolbarPath="object/inc">
         </action>
         <action
               definitionId="Decrement"
               icon="src/org/eclipse/gef/examples/logicdesigner/icons/minus.gif"
               id="Decrement"
               label="Decrement"
               menubarPath="object/inc"
               retarget="true"
               style="push"
               toolbarPath="object"> <!-- The issue is with this -->
         </action>
      </actionSet>

I changed the path in my plugin and it fixed the issue. This was working with previous Eclipse versions. Now you can add a better handling for this type of situation. Let me know if you could reproduce the issue too.
Comment 6 Peter Severin CLA 2012-12-08 10:22:13 EST
I forgot to specify that you may need to open the "Logic Perspective" perspective and maybe create a "Logic Diagram" file first. The issue is not visible on first run with a clean workspace. It appears on second run.

I was actually hoping that the fix for this issue will fix another blocking issue  that I have with IContextService activation. It didn't so I filed Bug 396128 with another test case (also based on GEF logic editor) that shows the issue. Paul, could you look at it please?
Comment 7 Joseph Benken CLA 2013-09-26 12:59:54 EDT
(In reply to Peter Severin from comment #0)
> When I try to customize this perspective in Eclipse 4.2.1 using
> *Window > Customize Perspective...* nothing happens and an error gets logged.

I am also running into this in Kepler (4.3.0).  I am unable to customize any of my perspectives.

> java.lang.ClassCastException:
> org.eclipse.e4.ui.model.application.ui.menu.impl.OpaqueToolItemImpl cannot
> be cast to org.eclipse.e4.ui.model.application.ui.basic.MTrimElement
> 	at
> org.eclipse.ui.internal.CoolBarToTrimManager.find(CoolBarToTrimManager.java:
> 266)

This line is the problem:
MTrimElement el = (MTrimElement) modelService.find(id, window);

Should be changed to something like this:
MUIElement muiElement = modelService.find(id, window);
MTrimElement el = muiElement instanceof MTrimElement? (MTrimElement) muiElement : null;

I recompiled CoolBarToTrimManager then replaced the classes in my org.eclipse.ui.workbench_3.105.0.v20130529-1406.jar.  Now I can finally customize my perspectives again.

This minor coding error is is causing severe breakage in the workbench UI.  Seems trivial to fix . . . hope this gets resolved soon.
Comment 8 Daniel Rolka CLA 2013-11-25 10:46:54 EST
The patch proposal has been sent to Gerrit: https://git.eclipse.org/r/#/c/18830/

Daniel
Comment 9 Dani Megert CLA 2013-11-27 05:32:01 EST
(In reply to Daniel Rolka from comment #8)
> The patch proposal has been sent to Gerrit:
> https://git.eclipse.org/r/#/c/18830/
> 
> Daniel

Submitted with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=828ba48a951c4ce56ec1a72784d3274057f93260
Comment 10 Paul Webster CLA 2013-11-27 10:29:59 EST
Daniel, that's half a fix (you've prevented the CCE).  But the cause seems to be that a TrimElement and some other MUIElement have the same id, and if you hit this case does that mean you've ignored the TrimElement because it hit the other MUIElement first?

PW
Comment 11 Daniel Rolka CLA 2013-11-27 11:04:51 EST
(In reply to Paul Webster from comment #10)
> Daniel, that's half a fix (you've prevented the CCE).  But the cause seems
> to be that a TrimElement and some other MUIElement have the same id, and if
> you hit this case does that mean you've ignored the TrimElement because it
> hit the other MUIElement first?
> 
> PW

The previous fix works fine with attached sample project, but I've prepared the new patch that handles this additional case: https://git.eclipse.org/r/#/c/18978/

Daniel
Comment 12 Daniel Rolka CLA 2013-11-27 11:40:05 EST
(In reply to Daniel Rolka from comment #11)
> (In reply to Paul Webster from comment #10)
> > Daniel, that's half a fix (you've prevented the CCE).  But the cause seems
> > to be that a TrimElement and some other MUIElement have the same id, and if
> > you hit this case does that mean you've ignored the TrimElement because it
> > hit the other MUIElement first?
> > 
> > PW
> 
> The previous fix works fine with attached sample project, but I've prepared
> the new patch that handles this additional case:
> https://git.eclipse.org/r/#/c/18978/
> 
> Daniel

Btw. do we have any validation against duplicated ids in UI? I've just started to think about other similar places in the code that can suffer from duplicates

Daniel
Comment 13 Paul Webster CLA 2013-11-27 16:24:51 EST
(In reply to Daniel Rolka from comment #11)
> The previous fix works fine with attached sample project, but I've prepared
> the new patch that handles this additional case:
> https://git.eclipse.org/r/#/c/18978/

Thanks, released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8253d4e71b639bfa437022d9e26249decb691982

(In reply to Daniel Rolka from comment #12)
> Btw. do we have any validation against duplicated ids in UI? I've just
> started to think about other similar places in the code that can suffer from
> duplicates

No, what are used as IDs are only unique depending on the subsystem they're used in.  For example, command IDs are unique, but menu item IDs are not even guaranteed unique within one menu (it's not progammatically enforced, although we've warned everybody to use only unique IDs).

PW
Comment 14 Daniel Rolka CLA 2013-12-10 12:23:00 EST
Verified in the build: I20131209-2000

Daniel
Comment 15 Vishal Sharnagat CLA 2017-10-17 02:27:43 EDT
I am getting the same error. I downloaded eclipse.platform.ui-8253d4e71b639bfa437022d9e26249decb691982.zip from http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8253d4e71b639bfa437022d9e26249decb691982. When I try to extract or open zip it says it is invalid. 

Could you please tell how to apply this fix to my development environment?
Comment 16 Dani Megert CLA 2017-12-19 07:09:31 EST
(In reply to Vishal Sharnagat from comment #15)
> I am getting the same error. I downloaded
> eclipse.platform.ui-8253d4e71b639bfa437022d9e26249decb691982.zip from
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8253d4e71b639bfa437022d9e26249decb691982.
> When I try to extract or open zip it says it is invalid. 

It works for me. Just save it and then open when the download has finished.
Comment 17 Eclipse Genie CLA 2018-01-10 09:23:14 EST
New Gerrit change created: https://git.eclipse.org/r/115177
Comment 18 Eclipse Genie CLA 2018-01-10 09:28:29 EST
New Gerrit change created: https://git.eclipse.org/r/115179
Comment 19 Eclipse Genie CLA 2018-01-10 09:34:43 EST
New Gerrit change created: https://git.eclipse.org/r/115180
Comment 20 Eclipse Genie CLA 2018-01-10 09:39:58 EST
New Gerrit change created: https://git.eclipse.org/r/115181
Comment 21 Vikas Chandra CLA 2018-01-10 09:51:10 EST
Branch 	R4_2_maintenance :
https://git.eclipse.org/r/115177  (fix)
https://git.eclipse.org/r/#/c/115179 ( version update)

Branch 	R4_3_maintenance :
https://git.eclipse.org/r/115180 (fix)
https://git.eclipse.org/r/115181 ( version update)
Comment 22 Sarika Sinha CLA 2018-01-10 22:57:35 EST
(In reply to Vikas Chandra from comment #21)
> Branch 	R4_2_maintenance :
> https://git.eclipse.org/r/115177  (fix)
> https://git.eclipse.org/r/#/c/115179 ( version update)
> 
Looks like version was updated for 4.2.2+  via https://bugs.eclipse.org/bugs/show_bug.cgi?id=163335 and http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_2_maintenance&id=96b71850c458247dc962fa4cf3fcbc308741f8ee
Comment 25 Sarika Sinha CLA 2018-01-11 03:47:18 EST
Version was already incremented for 4.2.2+ and 4.3.2+