Community
Participate
Working Groups
In Quick Access, 'Build Project - Build the selected project' is offered even if no valid selection exists. Selecting it results in a NullPointerException.
Created attachment 232620 [details] Add setEnabled implementation Note that my clean version of Eclipse didn't throw NullPointerException. I haven't figured out why yet, but the original problem still exists that the command is offered even when there is no valid selection.
I've pushed the change to https://git.eclipse.org/r/14013 for review PW
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=628269f5e83dac8a5eea458d9997d1a96c83f614 Thanks Tom. PW
I'm reopening this bug for several reasons: - When using 4.3 RC4 I cannot see this bug i.e. when I make a selection in the 'Package Explorer', the command is there. When I make no selection in the 'Package Explorer' or go to a view which does not provide a selection, the command is not there. And hence I could also not see the NPE. - A real problem (4.3 RC4 and with the patch) is that the list of previous choices is not updated and hence when one first selects 'Build Project' and then makes no selection, one can still select 'Build Project' from the previous choices and this will result in a NotEnabledException [1]. - Creating a new build command on each #setEnabled is overkill. - The copyright date (2012-3) is wrong it must be "2012, 2013" - The bundle version was not updated for Luna. [1] !ENTRY org.eclipse.ui 4 0 2013-06-25 14:30:10.461 !MESSAGE Trying to execute the disabled command org.eclipse.ui.project.buildProject !STACK 0 org.eclipse.core.commands.NotEnabledException: Trying to execute the disabled command org.eclipse.ui.project.buildProject at org.eclipse.core.commands.Command.executeWithChecks(Command.java:490) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213) at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:420) at org.eclipse.ui.internal.quickaccess.CommandElement.execute(CommandElement.java:69) at org.eclipse.ui.internal.quickaccess.SearchField$2.handleElementSelected(SearchField.java:164) at org.eclipse.ui.internal.quickaccess.QuickAccessContents.handleSelection(QuickAccessContents.java:438) at org.eclipse.ui.internal.quickaccess.QuickAccessContents.access$0(QuickAccessContents.java:428) at org.eclipse.ui.internal.quickaccess.QuickAccessContents$1.keyPressed(QuickAccessContents.java:472) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:167) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108) at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1726) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1525) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4723) at org.eclipse.swt.widgets.Text.WM_CHAR(Text.java:2611) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4611) at org.eclipse.swt.widgets.Text.windowProc(Text.java:2597) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:613) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) 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:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
I've reverted the change for now with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=20053fcbf5e11852796dc6172e5177a03eec5e7a For further investigation. PW
(In reply to comment #4) > - When using 4.3 RC4 I cannot > see this bug i.e. when I make a selection in the 'Package Explorer', the > command is there. When I make no selection in the 'Package Explorer' or go > to a view which does not provide a selection, the command is not there. > And hence I could also not see the NPE. I was using 4.2.2. > - A real problem (4.3 RC4 and with > the patch) is that the list of previous choices is not updated and hence > when one first selects 'Build Project' and then makes no selection, one > can still select 'Build Project' from the previous choices and this will > result in a NotEnabledException [1]. I did in fact fix this issue with bug 393703.
(In reply to comment #6) > (In reply to comment #4) > > - When using 4.3 RC4 I cannot > > see this bug i.e. when I make a selection in the 'Package Explorer', the > > command is there. When I make no selection in the 'Package Explorer' or go > > to a view which does not provide a selection, the command is not there. > > And hence I could also not see the NPE. > > I was using 4.2.2. OK. Can you try with 4.3 RC4? If it works there for you as well, we can close this bug.
I downloaded 4.3 RC3 from http://www.eclipse.org/downloads/index-developer.php. I didn't notice that it wasn't RC4 like you requested. How do I get RC4? Maybe this really is fixed in RC4, but I'm seeing some strangeness in RC3 that seems to indicate that there are some different behaviors possible, some like the case you described that can appear to work fine. 1. Start Eclipse with a new workspace. 2. Close the Welcome View. 3. In the Quick Access box type "Build Project" *without clicking anywhere else*. --> ERROR, note that the Build Project command appears in the Commands group. 4. Execute the command. --> ERROR, most of the time nothing happens, but I did see again an NPE like I had originally reported for this bug. 5. Type "Build Project" again. --> OK, command doesn't appear in Commands group. 6. Select the Outline View and type "Build Project". --> ERROR, the command appears again in the Commands group. 7. Execute the command multiple times. --> ERROR, the command continues to appear in the Commands group. java.lang.NullPointerException at org.eclipse.ui.actions.SelectionListenerAction.computeResources(SelectionListenerAction.java:116) at org.eclipse.ui.actions.SelectionListenerAction.getSelectedResources(SelectionListenerAction.java:227) at org.eclipse.ui.actions.BuildAction.getBuildConfigurationsToBuild(BuildAction.java:193) at org.eclipse.ui.actions.BuildAction.getProjectsToBuild(BuildAction.java:174) at org.eclipse.ui.actions.BuildAction.updateSelection(BuildAction.java:336) at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:124) at org.eclipse.ui.internal.ide.handlers.BuildProjectHandler.runBuildAction(BuildProjectHandler.java:72) at org.eclipse.ui.internal.ide.handlers.BuildProjectHandler.execute(BuildProjectHandler.java:51) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213) at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:420) at org.eclipse.ui.internal.quickaccess.CommandElement.execute(CommandElement.java:69) at org.eclipse.ui.internal.quickaccess.SearchField$2.handleElementSelected(SearchField.java:164) at org.eclipse.ui.internal.quickaccess.QuickAccessContents.handleSelection(QuickAccessContents.java:438) at org.eclipse.ui.internal.quickaccess.QuickAccessContents.access$0(QuickAccessContents.java:428) at org.eclipse.ui.internal.quickaccess.QuickAccessContents$1.keyPressed(QuickAccessContents.java:472) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:167) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108) at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1726) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1525) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4723) at org.eclipse.swt.widgets.Text.WM_CHAR(Text.java:2611) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4611) at org.eclipse.swt.widgets.Text.windowProc(Text.java:2597) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) 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:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
Our RC4 build is http://download.eclipse.org/eclipse/downloads/drops4/I20130605-2000/ PW
RC4 exhibits the same problems as RC3.
Created attachment 232916 [details] Updated patch I updated the patch, fixing the copyright, and creating only one BuildAction per instance.
(In reply to comment #4) > - The bundle version was not updated for Luna. I didn't change any API, so this isn't necessary, right?
(In reply to comment #12) > (In reply to comment #4) > - The bundle version was not updated for Luna. I > didn't change any API, so this isn't necessary, right? Oh, sorry, you probably mean the third field? 3.9.1 for MANIFEST.XML and pom.xml?
Moved review to gerrit: https://git.eclipse.org/r/14573
(In reply to comment #14) > Moved review to gerrit: https://git.eclipse.org/r/14573 Thanks for moving the review to Gerrit. I've added a comment there. PW
Since handling the multiple windows is too much, I think we're back to creating the build action as in http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=628269f5e83dac8a5eea458d9997d1a96c83f614 Dani, if you're fine with that and I'll update the bundle versions and copyrights and re-instate the fix. PW
(In reply to comment #16) > Since handling the multiple windows is too much, I think we're back to > creating the build action as in > http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/ > ?id=628269f5e83dac8a5eea458d9997d1a96c83f614 > > Dani, if you're fine with that and I'll update the bundle versions and > copyrights and re-instate the fix. > > PW Yes, if the problem really still exists on I20130724-1600 or newer.
I can still reproduce the problem in 4.4.0.I20130723-0800 1) uncheck build automatically 2) select a project in the Package Explorer 3) CTRL+3 and Build Project 4) unselect the project in the Package Explorer 5) CTRL+3 still offers Build Project It then throws the NotHandledException PW
(In reply to comment #18) > I can still reproduce the problem in 4.4.0.I20130723-0800 Which isn't late enough :-) I'll try again on tomorrow's I build PW
I can no longer reproduce this problem with the current build. Fixed by bug 393703 PW
Comment 18 talks about the reproducibility steps for a different issue, which indeed was fixed by bug 393703. Comment 8 has the reproducibility steps for this bug. I have fix 393703, and it definitely doesn't fix this bug. Can you confirm whether you followed the reproducibility steps in comment 8?
No, I followed the last one. I'll re-test with comment #8 PW
OK, I can reproduce the problem in comment #8 with 4.4.0.I20130730-0800 PW
With http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=bc7a94f2deaf9839d2b27e5bd0f224fb2d7017df it looks like the problem is fixed. PW
in 4.4.0.I20130806-2000 Thanks Tom PW