/** * Copyright (c) 2010, 2013 Darmstadt University of Technology. * 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: * Marcel Bruch - initial API and implementation. */ package org.eclipse.recommenders.internal.overrides.rcp; import javax.inject.Singleton; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.recommenders.overrides.IOverrideModelProvider; import org.eclipse.ui.IWorkbench; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Scopes; public class OverridesRcpModule extends AbstractModule { public OverridesRcpModule() { } @Override protected void configure() { bind(IOverrideModelProvider.class).to(RcpOverrideModelProvider.class).in(Scopes.SINGLETON); } @Provides @Singleton public OverridesRcpPreferences provide(IWorkbench wb) { IEclipseContext context = (IEclipseContext) wb.getService(IEclipseContext.class); return ContextInjectionFactory.make(OverridesRcpPreferences.class, context); } }