org.eclipse.xtext.xbase.testing.SynchronizedXtextResourceSetProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.xtext.xbase.testing Show documentation
Show all versions of org.eclipse.xtext.xbase.testing Show documentation
Infrastructure for testing Xbase languages.
The newest version!
/*******************************************************************************
* Copyright (c) 2013, 2017 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.xtext.xbase.testing;
import org.eclipse.xtext.common.types.access.IJvmTypeProvider;
import org.eclipse.xtext.resource.SynchronizedXtextResourceSet;
import com.google.inject.Inject;
import com.google.inject.Provider;
/**
* Yields an empty resource set that is configured with an injected class loader
* and a classpath based {@link IJvmTypeProvider}.
*
* @author Sebastian Zarnekow
* @since 2.4
*/
public class SynchronizedXtextResourceSetProvider implements Provider {
@Inject
private ClassLoader classLoader;
@Inject
private IJvmTypeProvider.Factory typeProviderFactory;
@Override
public SynchronizedXtextResourceSet get() {
SynchronizedXtextResourceSet result = new SynchronizedXtextResourceSet();
result.setClasspathURIContext(classLoader);
typeProviderFactory.findOrCreateTypeProvider(result);
return result;
}
}