Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 394171 - 'Build All' menu item not correctly enabled and disabled
Summary: 'Build All' menu item not correctly enabled and disabled
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.2.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.2.2   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 07:06 EST by Dani Megert CLA
Modified: 2013-01-25 04:02 EST (History)
2 users (show)

See Also:
daniel_megert: pmc_approved+
pwebster: review+


Attachments
Possible Fix (1.90 KB, patch)
2013-01-23 12:46 EST, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2012-11-13 07:06:36 EST
4.2-M20121107-1200 and master.

The 'Build All' menu item is not correctly enabled and disabled.

Test Case 1:
1. start a workspace where 'Build automatically' is selected
   ==> Project > Build All is correctly disabled
2. toggle 'Build automatically'
   BUG: Project > Build All still disabled
   NOTE: the command is enabled i.e. using Ctrl+B actually triggers a build 
         and then also enables the menu
3. toggle 'Build automatically'
   BUG: Project > Build All still enabled
4. Project > Build All
==>
!ENTRY org.eclipse.ui.workbench 4 0 2012-11-13 12:57:04.738
!MESSAGE Trying to execute the disabled command org.eclipse.ui.project.buildAll
!STACK 0
org.eclipse.core.commands.NotEnabledException: Trying to execute the disabled command org.eclipse.ui.project.buildAll
	at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:510)
	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:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:587)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:542)
	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:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	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 1 Chris Recoskie CLA 2013-01-15 14:02:20 EST
I have hit this as well.  I have Build Automatically turned off.  The enablement state only seems to be calculated on startup.  If on startup the workspace is empty or all projects are closed, the command never gets enabled.  If I change org.eclipse.ui.internal.ide.handlers.BuildAllProjectsHandler.setEnabled(Object) to always do setBaseEnabled(true) then the menu is enabled on startup(not that I'm suggesting that as a fix, just to help illustrate where the problem lies).
Comment 2 Dani Megert CLA 2013-01-23 12:45:50 EST
Bug 396418 might be a duplicate of this one. And also bug 366560.
Comment 3 Dani Megert CLA 2013-01-23 12:46:32 EST
Created attachment 225996 [details]
Possible Fix
Comment 4 Paul Webster CLA 2013-01-23 13:47:08 EST
I looked at the patch and it looks good, it's providing the setEnabled(*) API through our 4.x handler proxy.  It uses the same pattern as the other 4.x handler proxy methods.

I've released this for 4.2.2 to be picked up on any rebuild.

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

PW
Comment 6 Dani Megert CLA 2013-01-25 04:02:13 EST
Verified in 4.2-M20130124-1700