Bug 338559 ui.services has a dependency on SWT
bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/internal/events/UIEventHandler.java
final private boolean headless;
	
	public UIEventHandler(EventHandler eventHandler, boolean headless) {
		this.eventHandler = eventHandler;
		this.headless = headless;
	}
	
	/* (non-Javadoc)
	 * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
	 */
	public void handleEvent(final Event event) {
		if (headless)
			eventHandler.handleEvent(event);
		else {
			
			
			
			if (Display.getCurrent() != null) {
				eventHandler.handleEvent(event);
				return;
			}
			Display.getDefault().syncExec(new Runnable() { 
				public void run() {
					eventHandler.handleEvent(event);
				}
			});
		}
	}
}