Project: Eclipse_Platform_UI
Bug 385394 Performance issue regarding enabled state handling for menuContributions containing command (ToolItemUpdateTimer puts constant load on CPU)
Reported: 2012-07-18 07:41:06 | Status: resolved fixed

Build Identifier: Version: 4.2.0 Build id: I20120608-1400 Hi colleagues, we are using toolbar menu contributions pointing to a command like in following example: <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:mytoolbar"> <command commandId="mycommand" ... Our handler implementation of the command overrides the methods setEnabled and isEnabled to calculate the enabled state of the toolbar entry. This implementation is not very efficient and can take some time (backend calls needed). We had no problems with this implementation in eclipse 3.7. With Eclipse 4.2, we are now running into performance problems; it looks like that the setEnabled method is called all 400 ms which looks very strange. Why is this method called so often? Is there another mechanism/possibility in Eclipse 4.2 to contribute toolbar menu entries where the setEnabled method is called only then when it is necessary (when current focus/selection/part is changed)? With best regards, Tobias Reproducible: Always

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarContributionRecord.java bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolBarManagerRenderer.java bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ToolItemUpdater.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java