| Summary: | [Compatibility] QuickAccess will execute commands in an incorrect context | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Paul Webster <pwebster> | ||||||||||
| Component: | UI | Assignee: | Remy Suen <remy.suen> | ||||||||||
| Status: | VERIFIED FIXED | QA Contact: | Remy Suen <remy.suen> | ||||||||||
| Severity: | major | ||||||||||||
| Priority: | P3 | CC: | bokowski, john.arthorne, Lars.Vogel, remy.suen | ||||||||||
| Version: | 1.0 | Flags: | remy.suen:
review+
|
||||||||||
| Target Milestone: | 1.0 RC3 | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Paul Webster
*** Bug 318744 has been marked as a duplicate of this bug. *** There may be a different NPE now, see bug 318744. This worked for me early in my usage of I20100701-1105 But not now: null Error Mon Jul 05 10:40:11 EDT 2010 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.ui.internal.ide.commands.CopyBuildIdToClipboardHandler.execute(CopyBuildIdToClipboardHandler.java:44) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:56) at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:42) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:193) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:170) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:101) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:135) at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommandInContext(LegacyHandlerService.java:296) at org.eclipse.ui.internal.quickaccess.CommandElement.execute(CommandElement.java:49) at org.eclipse.ui.internal.quickaccess.SearchField$1.handleElementSelected(SearchField.java:60) at org.eclipse.ui.internal.quickaccess.QuickAccessContents.handleSelection(QuickAccessContents.java:324) at org.eclipse.ui.internal.quickaccess.QuickAccessContents.access$0(QuickAccessContents.java:314) at org.eclipse.ui.internal.quickaccess.QuickAccessContents$1.keyPressed(QuickAccessContents.java:343) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:161) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294) at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2839) at org.eclipse.swt.widgets.Text.gtk_key_press_event(Text.java:1451) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4794) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4372) at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8163) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1239) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2224) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3169) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:664) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:589) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:103) at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:535) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:519) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) 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:369) 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: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:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) Simplest fix is to just get the Display from the IWorkbench. Or we can do it right and try to get ISources.ACTIVE_SHELL_NAME set properly in the context. Note that the shell may not necessarily be the shell of a workbench window. 'Help > About' works but 'Ctrl+3 > About' doesn't. The former uses the window's context during command execution whereas the latter uses some (random?) anonymous context. Created attachment 174966 [details]
CommandProvider patch v1
Patch to change CommandProvider to delay the creation of the context snapshot until it's actually asked for.
This wasn't a problem in 3.x because the CommandProvider was only created when Ctrl+3 was actually hit. In 4.0, the CommandProvider is instantiated right in the beginning as it is constructed by an MToolControl so the snapshot quickly becomes "outdated".
Paul, please review and perform a risk assessment. Boris, please evaluate the severity for RC3 consideration. Created attachment 174996 [details]
CommandProvider v02
Remy, what about this one.
PW
(In reply to comment #9) > Created an attachment (id=174996) [details] > CommandProvider v02 > > Remy, what about this one. Mm, looks good. This also allows us to capture the state of the application _before_ the dialog actually appears. I think we need to do even more changes, since the CommandProvider is going to cache all elements and won't recompute them ever again. I'll attach a new patch. (In reply to comment #11) > I think we need to do even more changes, since the CommandProvider is going to > cache all elements and won't recompute them ever again. Indeed. It never picks up newly opened editors (and presumably amongst other problems). I guess no one ever uses Ctrl+3 to switch between editors. Created attachment 175003 [details]
proposed patch
Worked on this with Remy.
Created attachment 175012 [details]
quick access v04
Contains a minor change to use the window context instead of the focus control context.
Remy, if you +1 this patch Boris says we can release it.
PW
(In reply to comment #14) > Remy, if you +1 this patch Boris says we can release it. Released to CVS HEAD. Verified with I20100726-2152 on Windows XP. |