Bug 311721 - Cleanup context strategy
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/EclipseContextFactory.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/EclipseContextFactory.java
index 90c7943..bd17502 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/EclipseContextFactory.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/EclipseContextFactory.java
@@ -13,15 +13,11 @@
 
 import java.util.WeakHashMap;
 import org.eclipse.e4.core.internal.contexts.EclipseContext;
-import org.eclipse.e4.core.internal.contexts.ILookupStrategy;
 import org.eclipse.e4.core.internal.contexts.osgi.OSGiContextStrategy;
 import org.osgi.framework.BundleContext;
 
 /**
- * A factory for creating a simple context instance. Simple contexts must be filled in
- * programmatically by calling {@link IEclipseContext#set(String, Object)} to provide context
- * values, or by providing an {@link ILookupStrategy} to be used to initialize values not currently
- * defined in the context.
+ * A factory for creating context instances.
  */
 public final class EclipseContextFactory {
 
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
index 52c0093..764c671 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
@@ -248,7 +248,7 @@
 	final Map<LookupKey, ValueComputation> localValueComputations = Collections.synchronizedMap(new HashMap<LookupKey, ValueComputation>());
 	final Map<String, Object> localValues = Collections.synchronizedMap(new HashMap<String, Object>());
 
-	private final IEclipseContextStrategy strategy;
+	private final ILookupStrategy strategy;
 
 	private ArrayList<String> modifiable;
 
@@ -256,7 +256,7 @@
 
 	private Set<WeakReference<EclipseContext>> children = new HashSet<WeakReference<EclipseContext>>();
 
-	public EclipseContext(IEclipseContext parent, IEclipseContextStrategy strategy) {
+	public EclipseContext(IEclipseContext parent, ILookupStrategy strategy) {
 		this.strategy = strategy;
 		setParent(parent);
 		if (parent == null)
@@ -275,8 +275,8 @@
 		IEclipseContext parent = getParent();
 		if (parent != null && parent.containsKey(name))
 			return true;
-		if (strategy instanceof ILookupStrategy) {
-			if (((ILookupStrategy) strategy).containsKey(name, this))
+		if (strategy != null) {
+			if (strategy.containsKey(name, this))
 				return true;
 		}
 		return false;
@@ -353,7 +353,6 @@
 			processScheduled(scheduled);
 		}
 
-		// TBD used by OSGI Context strategy - is this needed? Looks like @PreDestroy
 		if (strategy instanceof IDisposable)
 			((IDisposable) strategy).dispose();
 		listeners.clear();
@@ -391,8 +390,8 @@
 		Object result = localValues.get(name);
 
 		// 2. try the local strategy
-		if (result == null && strategy instanceof ILookupStrategy)
-			result = ((ILookupStrategy) strategy).lookup(name, originatingContext);
+		if (result == null && strategy != null)
+			result = strategy.lookup(name, originatingContext);
 
 		// if we found something, compute the concrete value and return
 		if (result != null) {
@@ -490,17 +489,13 @@
 	}
 
 	protected void processScheduled(List<Scheduled> scheduledList) {
-		boolean useScheduler = (strategy != null && strategy instanceof ISchedulerStrategy);
 		HashSet<Scheduled> sent = new HashSet<Scheduled>(scheduledList.size());
 		for (Iterator<Scheduled> i = scheduledList.iterator(); i.hasNext();) {
 			Scheduled scheduled = i.next();
 			// don't send the same event twice
 			if (!sent.add(scheduled))
 				continue;
-			if (useScheduler)
-				((ISchedulerStrategy) strategy).schedule(scheduled.runnable, scheduled.event);
-			else
-				scheduled.runnable.notify(scheduled.event);
+			scheduled.runnable.notify(scheduled.event);
 		}
 	}
 
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextStrategy.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextStrategy.java
deleted file mode 100644
index 114a4e7..0000000
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextStrategy.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.e4.core.internal.contexts;
-
-/**
- * This is a marker interface. All strategies passed to the context must
- * implement this interface.
- */
-public interface IEclipseContextStrategy {
-	// intentionally left empty
-}
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ILookupStrategy.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ILookupStrategy.java
index cc6506d..81c6905 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ILookupStrategy.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ILookupStrategy.java
@@ -11,7 +11,6 @@
 package org.eclipse.e4.core.internal.contexts;
 
 import org.eclipse.e4.core.contexts.ContextFunction;
-import org.eclipse.e4.core.contexts.EclipseContextFactory;
 import org.eclipse.e4.core.contexts.IEclipseContext;
 
 /**
@@ -19,10 +18,8 @@
  * in a context. The lookup strategy is consulted by the context after
  * looking for an already defined local value, but before delegating lookup
  * to a parent context.
- * 
- * @see EclipseContextFactory#create(IEclipseContext, IEclipseContextStrategy)
  */
-public interface ILookupStrategy extends IEclipseContextStrategy {
+public interface ILookupStrategy {
 	/**
 	 * Looks up a value for the given name to be associated with the given context.
 	 * @param name The name of the context value to look up
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ISchedulerStrategy.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ISchedulerStrategy.java
deleted file mode 100644
index 8852244..0000000
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ISchedulerStrategy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.e4.core.internal.contexts;
-
-import org.eclipse.e4.core.contexts.ContextChangeEvent;
-import org.eclipse.e4.core.contexts.IRunAndTrack;
-
-/**
- * A context strategy for queueing and invoking runnables that are tracking changes in the context.
- * Implementations of this strategy must queue and invoke runnables in the order they are scheduled.
- */
-public interface ISchedulerStrategy extends IEclipseContextStrategy {
-
-	/**
-	 * Schedules a runnable for execution.
-	 * 
-	 * @param runnable
-	 *            The runnable to execute
-	 */
-	public void schedule(Runnable runnable);
-
-	/**
-	 * This is the same method but for more involved listeners. It should pass in the event
-	 * describing the changes that occurred in the context
-	 * 
-	 * @return <code>true</code> if the runnable is still valid, or <code>false</code> to indicate
-	 *         this runnable is no longer valid and should be removed from the context.
-	 */
-	public boolean schedule(IRunAndTrack runnable, ContextChangeEvent event);
-
-}