This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 390921 - InjectionException when using Context-Menu
Summary: InjectionException when using Context-Menu
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.2.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2.2   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 385123 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-02 07:59 EDT by rgra Missing name CLA
Modified: 2013-04-08 10:34 EDT (History)
8 users (show)

See Also:


Attachments
Fix up the context for a popup contained in a popup (2.21 KB, patch)
2012-11-02 10:34 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rgra Missing name CLA 2012-10-02 07:59:25 EDT
Since updating to 4.2 SR1 I get an exception when using Rational Team Concert (RTC) Plugin in eclipse and right-clicking on a Pending-Changes Changeset. After a restart it works for some time and than fails with below exception.
The context menu is not opened and RTC can not be used without this menu.

!ENTRY org.eclipse.ui 4 0 2012-10-02 13:43:22.864
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: Unable to process "HandledContributionItem.commandService": no actual value was found for the argument "ECommandService".
	at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:394)
	at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:385)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:100)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.processHandledItem(MenuManagerRenderer.java:701)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.modelProcessSwitch(MenuManagerRenderer.java:583)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.processMenu(MenuManagerRenderer.java:562)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.modelProcessSwitch(MenuManagerRenderer.java:595)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.processContents(MenuManagerRenderer.java:517)
	at org.eclipse.ui.internal.PopupMenuExtender.addMenuContributions(PopupMenuExtender.java:408)
	at org.eclipse.ui.internal.PopupMenuExtender.menuAboutToShow(PopupMenuExtender.java:379)
	at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:343)
	at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:475)
	at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:470)
	at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:500)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:255)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
	at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4881)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4557)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
	at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
	at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:257)
	at org.eclipse.swt.widgets.Display.runPopups(Display.java:4210)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	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)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)


-- Configuration Details --
Product: Eclipse 1.5.1.20120828-0743 (org.eclipse.epp.package.rcp.product)
Installed Features:
 org.eclipse.platform 4.2.1.v20120814-120134-9JF7BHVGFyMveli1uX6aTH0q-eAap6PAgOP5mO
Comment 1 Paul Webster CLA 2012-10-02 09:34:14 EDT
Applicable work item: https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=205774

You should have a look at their comments (jazz.net is a developer site for Jazz and RTC)

PW
Comment 2 rgra Missing name CLA 2012-10-02 09:46:11 EDT
Yes I know that bug. But the situation got worse with 4.2.1. There's no context-menu shown at all any more. Thus can't use my posted usual workaround. 

There must be a change introduced in 4.2.1 which makes it unusable now. But since I know that RTC is strictly not compatible with 4.x at all, I'm not sure if this is an eclipse bug at all.

I just can't understand why the ECommandService is not found, because it should got registered with the EclipseContext on startup.
Comment 3 Paul Webster CLA 2012-10-02 09:51:24 EDT
I haven't looked at this in a while, but it might be in their management of the context menus themselves.  If they somehow manage to "disconnect" the popup menu from the rest of the model or if they're whipping up their own ServiceLocator, it could be disconnected from the runtime IEclipseContext hierarchy and that's why it's being warned as missing.

I posted the comment on the work item, maybe we can start more investigation on their side and mine (we made a change to MenuManager that should make opening menus *less* invasive).

PW
Comment 4 Andrew Johnson CLA 2012-10-08 03:35:15 EDT
I see this problem too, with 
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/SR1/eclipse-jee-juno-SR1-win32-x86_64.zip
and
https://jazz.net/downloads/rational-team-concert/releases/3.0.1.4/RTC-Client-p2Repo-3.0.1.4.zip

Sometimes it works for me, if I close and reopen the pending changes view, but once it goes wrong then I have to close and reopen.

A partial work-around is to use ctrl-shift F11 to deliver change sets.

I also see this problem for Defects > Links > Change Sets

org.eclipse.e4.core.di.InjectionException: Unable to process "HandledContributionItem.commandService": no actual value was found for the argument "ECommandService".
	at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:394)
	at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:385)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:100)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.processHandledItem(MenuManagerRenderer.java:701)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.modelProcessSwitch(MenuManagerRenderer.java:583)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer.processContents(MenuManagerRenderer.java:517)
	at org.eclipse.ui.internal.PopupMenuExtender.addMenuContributions(PopupMenuExtender.java:408)
	at org.eclipse.ui.internal.PopupMenuExtender.menuAboutToShow(PopupMenuExtender.java:379)
	at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:343)
	at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:475)
	at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:470)
	at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:500)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:255)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
	at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4881)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4557)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
	at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
	at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:257)
	at org.eclipse.swt.widgets.Display.runPopups(Display.java:4210)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	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:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	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)
Comment 5 Remy Suen CLA 2012-10-22 14:18:25 EDT
(In reply to comment #4)
> I also see this problem for Defects > Links > Change Sets

Note that the cause for that problem is different from the cause behind the 'Pending Changes' view not functioning. I have described the problem with RTC's work item editor in bug 379849 comment 1.
Comment 6 Paul Webster CLA 2012-11-02 10:34:10 EDT
Created attachment 223113 [details]
Fix up the context for a popup contained in a popup

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=pwebster/bug390921&id=a5fba9b0a71443ead6a97df20ee575af807357b9

If the registered context menu is contained within another menu, hook up the context to the outer context.

Recommendation one:

Make sure both context menus have the removeAllWhenShown flag set to true.

Recommendation two:

This is not really what that API was meant for, and breaks the UX notion that the context menu is operating on the current selection.  I'd suggest looking for a different tact to provide a submenu if necessary.

PW
Comment 8 Remy Suen CLA 2012-11-30 08:57:28 EST
(In reply to comment #6)
> Created attachment 223113 [details]
> Fix up the context for a popup contained in a popup

This fix isn't quite enough because it seems the context only gets created if the code goes through the 'else' clause of the MenuManagerRenderer. I am seeing cases where the code is executed in the 'if' clause. When that happens, the child context doesn't get created so the InjectionException happens again. Moving the code out so that the child context always gets created (if there isn't one) appears to fix the problem for me.
Comment 9 Paul Webster CLA 2012-11-30 09:04:51 EST
Thanks for the analysis Remy, I've released the fix:


http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_2_maintenance&id=96165e8bdd8dc5f3192dbca185edb4941e6fdca5

PW
Comment 10 Paul Webster CLA 2013-01-17 12:51:08 EST
In M20130116-1800

PW
Comment 11 Andy Armstrong CLA 2013-02-14 17:00:59 EST
I am having the same problem using this version of eclipse :

Version: Juno Service Release 1
Build id: 20121004-1855

Can somebody please detail how I can install the fix to my existing eclipse!?
Comment 12 Gary Johnston CLA 2013-02-15 13:39:32 EST
Seconded. How can I get this fix?
Comment 13 Paul Webster CLA 2013-02-15 15:31:07 EST
It will be available in 4.2.2 when it is released in a week or two.  There's nothing installable into 4.2.1 that will fix this, you would have to backport the fix yourself and build that jar.

It looks like it might already be backported against R4_2_1: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/log/?h=R4_2_1_maintenance_patches

PW
Comment 14 Paul Webster CLA 2013-04-08 10:34:59 EDT
*** Bug 385123 has been marked as a duplicate of this bug. ***