Bug 344690 Event handlers do not get removed as a part gets reinjected with a different event broker
diff --git a/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/events/EventBrokerFactory.java b/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/events/EventBrokerFactory.java
index 1f39a63..f4f61b7 100644
--- a/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/events/EventBrokerFactory.java
+++ b/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/events/EventBrokerFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -28,7 +28,12 @@
 public class EventBrokerFactory extends ContextFunction {
 	@Override
 	public Object compute(IEclipseContext context) {
-		return ContextInjectionFactory.make(EventBroker.class, context);
+		EventBroker broker = context.get(EventBroker.class);
+		if (broker == null) {
+			broker = ContextInjectionFactory.make(EventBroker.class, context);
+			context.set(EventBroker.class, broker);
+		}
+		return broker;
 	}
 }