Project: Eclipse_Platform_UI
Bug 210862 [Contributions] CommandContributionItem must ensure that updates are forwarded in Display thread
Reported: 2007-11-25 08:59:07 | Status: verified fixed

If an command handler fires a changed event (HandlerEvent, e.g. enablement changed), this happens not implicitly in the Display thread. (Commands and handlers does not depend on SWT, right?). At moment, you get: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:3706) at org.eclipse.swt.SWT.error(SWT.java:3624) at org.eclipse.swt.SWT.error(SWT.java:3595) at org.eclipse.swt.widgets.Widget.error(Widget.java:441) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:335) at org.eclipse.swt.widgets.MenuItem.setText(MenuItem.java:1001) at org.eclipse.ui.menus.CommandContributionItem.update(CommandContributionItem.java:457) at org.eclipse.ui.menus.CommandContributionItem$2.commandChanged(CommandContributionItem.java:289) at org.eclipse.core.commands.Command$1.run(Command.java:510) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.commands.Command.fireCommandChanged(Command.java:505) Perhaps CommandContributionItem$2.commandChanged should create a runnable for Display.exec ?

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