Bug 261852 [context] Separate code into API / SPI / internal
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/SelectionServiceValue.java
public Object getSelection(Class api) {
			Object value = getValue();
			if (api.isInstance(value)) {
				return value;
			}
			if (value instanceof IStructuredSelection) {
				value = ((IStructuredSelection) value).getFirstElement();
			}
			if (api.isInstance(value)) {
				return value;
			} else if (value != null) {
				return Platform.getAdapterManager().loadAdapter(value,
						api.getName());
			}
			return null;
		}
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.e4.core.services.ComputedValue#compute(org.eclipse.e4.core
	 * .services.Context)
	 */
	@Override
	protected Object compute(Context context) {
		return new SelectionWritableValue();
	}
}