Project: Eclipse_Platform_UI
Bug 232489 [Contributions] Switching editors updates TooItems updated due to calls to org.eclipse.ui.menus.CommandContributionItem.updateIcons()
Reported: 2008-05-16 08:47:05 | Status: resolved fixed

I20080515-2000. When switching between two editors in 3.3 there were no calls to org.eclipse.ui.menus.CommandContributionItem.updateIcons(). Now in 3.4 this method is called 9 times due to CommandEvent/s being handled (call see stack below). This causes SWT ToolItems to be update/redrawn. This is responsible for 1/3 of the regression seen in JDT Text editor activation tests. On my machine this is 40-60 ms. Thread [main] (Suspended (breakpoint at line 303 in CommandContributionItem$2)) CommandContributionItem$2.commandChanged(CommandEvent) line: 303 Command$1.run() line: 511 SafeRunner.run(ISafeRunnable) line: 37 Command.fireCommandChanged(CommandEvent) line: 506 Command.setHandler(IHandler) line: 995 HandlerAuthority.updateCommand(String, IHandlerActivation) line: 457 HandlerAuthority.deactivateHandler(IHandlerActivation) line: 292 HandlerService.deactivateHandler(IHandlerActivation) line: 148 SlaveHandlerService.deactivateHandler(IHandlerActivation) line: 205 EditorActionBars(SubActionBars).setGlobalActionHandler(String, IAction) line: 523 TextEditorActionContributor.doSetActiveEditor(IEditorPart) line: 101 TextEditorActionContributor.setActiveEditor(IEditorPart) line: 143 EditorActionBars.partChanged(IWorkbenchPart) line: 335 WorkbenchPage$3.run() line: 628 SafeRunner.run(ISafeRunnable) line: 37 Platform.run(ISafeRunnable) line: 880 WorkbenchPage.activatePart(IWorkbenchPart) line: 617 WorkbenchPage.setActivePart(IWorkbenchPart) line: 3451 WorkbenchPage.requestActivation(IWorkbenchPart) line: 2998 EditorPane(PartPane).requestActivation() line: 272 EditorPane.requestActivation() line: 98 EditorPane(PartPane).setFocus() line: 318 EditorPane.setFocus() line: 127 EditorStack(PartStack).presentationSelectionChanged(IPresentablePart) line: 846 PartStack.access$1(PartStack, IPresentablePart) line: 829 PartStack$1.selectPart(IPresentablePart) line: 139 TabbedStackPresentation$1.handleEvent(TabFolderEvent) line: 133 DefaultTabFolder(AbstractTabFolder).fireEvent(TabFolderEvent) line: 267 DefaultTabFolder(AbstractTabFolder).fireEvent(int, AbstractTabItem) line: 276 DefaultTabFolder.access$1(DefaultTabFolder, int, AbstractTabItem) line: 1 DefaultTabFolder$2.handleEvent(Event) line: 87 EventTable.sendEvent(Event) line: 84 CTabFolder(Widget).sendEvent(Event) line: 1002 CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1026 CTabFolder(Widget).sendEvent(int, Event) line: 1011 CTabFolder(Widget).notifyListeners(int, Event) line: 769 CTabFolder.setSelection(int, boolean) line: 3238 CTabFolder.onMouse(Event) line: 2013 CTabFolder$1.handleEvent(Event) line: 316 EventTable.sendEvent(Event) line: 84 CTabFolder(Widget).sendEvent(Event) line: 1002 Display.runDeferredEvents() line: 3801 Display.readAndDispatch() line: 3400 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2387 Workbench.runUI() line: 2351 Workbench.access$4(Workbench) line: 2203 Workbench$5.run() line: 493 Realm.runWithDefault(Realm, Runnable) line: 288 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 488 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 112 EclipseAppHandle.run(Object) line: 193 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 379 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 Main.invokeFramework(String[], URL[]) line: 549 Main.basicRun(String[]) line: 504 Main.run(String[]) line: 1236 Main.main(String[]) line: 1212

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java