Bug 270989 Context refactoring
Based on discussions over the past weeks, I'm doing a refactoring of the context API. Major changes: - Renamed IComputedValue to IContextFunction - Renamed *Value to *Function - Renamed UIContextScheduler to UISchedulerStrategy - Added concept of ILookupStrategy to delegate lookup of keys that are not yet defined in a given context - Re-implemented OSGi service support using lookup strategy I also fixed a couple of NPE's I found while testing with the e4 photo demo (null realms, etc)
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/workbench/ui/renderers/swt/ContributedPartFactory.java
package org.eclipse.e4.workbench.ui.renderers.swt;
import org.eclipse.e4.core.services.context.EclipseContextFactory;
import org.eclipse.e4.core.services.context.IEclipseContext;
import org.eclipse.e4.core.services.context.spi.IContextConstants;
import org.eclipse.e4.ui.model.application.MContributedPart;
import org.eclipse.e4.ui.model.application.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.workbench.ui.IHandlerService;
import org.eclipse.e4.workbench.ui.internal.UIContextScheduler;
import org.eclipse.e4.workbench.ui.renderers.PartHandlerService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;
/**
 * Create a contribute part.
 */
public class ContributedPartFactory extends SWTPartFactory {
	public Object createWidget(final MPart<?> part) {
		Widget parentWidget = getParentWidget(part);
		IEclipseContext parentContext = getContextForParent(part);
		Widget newWidget = null;
		if (part instanceof MContributedPart<?>) {
			final Composite newComposite = new Composite(
					(Composite) parentWidget, SWT.NONE);
			newWidget = newComposite;
			bindWidget(part, newWidget);