blob: cb5ff608fd3139f8d33a130e6b94aee59140a0b9 [file] [log] [blame]
package org.eclipse.osbp.ecview.extension.strategy;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.osbp.ecview.extension.api.IFocusingStrategy;
import org.osgi.service.component.annotations.Component;
@Component(service = IContextFunction.class, property = "service.context.key=Focusing")
public class FocusingStrategyContextFunction implements IContextFunction {
@Override
public Object compute(final IEclipseContext context, final String contextKey) {
MApplication application = context.get(MApplication.class);
IEclipseContext appCtx = application.getContext();
IFocusingStrategy provider = ContextInjectionFactory.make(FocusingStrategy.class, appCtx);
appCtx.set(IFocusingStrategy.class, provider);
return provider;
}
}