/** * Copyright (c) 2015 Codetrails GmbH. * 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: * Andreas Sewe - initial API and implementation. */ package org.eclipse.recommenders.internal.constructors.rcp; import javax.inject.Singleton; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.recommenders.constructors.IConstructorModelProvider; import org.eclipse.ui.IWorkbench; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Scopes; public class ConstructorsRcpModule extends AbstractModule { protected void configure() { bind(IConstructorModelProvider.class).to(EclipseConstructorModelProvider.class).in(Scopes.SINGLETON); }; @Provides @Singleton public ConstructorsRcpPreferences provide(IWorkbench wb) { IEclipseContext context = (IEclipseContext) wb.getService(IEclipseContext.class); return ContextInjectionFactory.make(ConstructorsRcpPreferences.class, context); } }