Bug 316363 SWTExceptions with @UIEventTopic on bundle shutdown
BuildId: HEAD from 2010/06/09 AM I'm porting the e4rover code to HEAD. It makes use of the @UIEventTopic annotation. On shutdown, I get dozens of SWTExceptions like the the following: ***WARNING: Display must be created on main thread due to Cocoa restrictions. 2010-06-09 15:11:28.399 Log ErrorException while dispatching event org.osgi.service.event.Event [topic=org/eclipsecon/e4rover/robot] to handler org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler@6a581b90 org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:4083) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.SWT.error(SWT.java:3969) at org.eclipse.swt.widgets.Display.error(Display.java:1027) at org.eclipse.swt.widgets.Display.createDisplay(Display.java:794) at org.eclipse.swt.widgets.Display.create(Display.java:777) at org.eclipse.swt.graphics.Device.<init>(Device.java:130) at org.eclipse.swt.widgets.Display.<init>(Display.java:668) at org.eclipse.swt.widgets.Display.<init>(Display.java:659) at org.eclipse.swt.widgets.Display.getDefault(Display.java:1303) at org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler.handleEvent(UIEventObjectSupplier.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipsecon.e4rover.core.ContestPlatform.fireRobotUpdated(ContestPlatform.java:262) at org.eclipsecon.e4rover.core.ContestPlatform.access$7(ContestPlatform.java:260) at org.eclipsecon.e4rover.core.ContestPlatform$1.run(ContestPlatform.java:172)
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
import org.eclipse.e4.ui.internal.workbench.ExceptionHandler;
import org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory;
import org.eclipse.e4.ui.internal.workbench.ResourceHandler;
import org.eclipse.e4.ui.internal.workbench.WorkbenchLogger;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MContribution;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.services.IStylingEngine;
import org.eclipse.e4.ui.workbench.IExceptionHandler;
import org.eclipse.e4.ui.workbench.IModelResourceHandler;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.swt.WorkbenchSWTActivator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
 *
 */
public class E4Application implements IApplication {