@Before public void setUp() throws Exception { ResourceSet resourceSet = new ResourceSetImpl(); Resource syntheticResource = new XMLResourceImpl(URI.createURI("http://synthetic.resource")); resourceSet.getResources().add(syntheticResource); typeProvider = new ClasspathTypeProvider(getClass().getClassLoader(), resourceSet, null, null); }
@Override protected ClasspathTypeProvider createClasspathTypeProvider(ResourceSet resourceSet) { ClassLoader classLoader = getClassLoader(resourceSet); CachingDeclaredTypeFactory actualFactoryToUse = reusedFactory; if (!isDefaultClassLoader(classLoader)) { actualFactoryToUse = newClassReaderTypeFactory(classLoader); } return new CachingClasspathTypeProvider( classLoader, resourceSet, getIndexedJvmTypeAccess(), actualFactoryToUse, services); }
@Override public ClasspathTypeProvider createTypeProvider(ResourceSet resourceSet) { if (resourceSet == null) throw new IllegalArgumentException("resourceSet may not be null."); ClasspathTypeProvider result = createClasspathTypeProvider(resourceSet); return result; }
protected void installTypeProvider(final Iterable<String> classPathRoots, final XtextResourceSet resSet, final IndexedJvmTypeAccess typeAccess) { final URLClassLoader classLoader = this.createURLClassLoader(classPathRoots); new ClasspathTypeProvider(classLoader, resSet, typeAccess, null); resSet.setClasspathURIContext(classLoader); }
@Test public void testCreateTypeProvider_01() { ClasspathTypeProvider typeProvider = factory.createTypeProvider(); assertNotNull(typeProvider); assertNotNull(typeProvider.getResourceSet()); }
@Test public void testCreateTypeProvider_02() { ResourceSet resourceSet = new ResourceSetImpl(); ClasspathTypeProvider typeProvider = factory.createTypeProvider(resourceSet); assertNotNull(typeProvider); assertEquals(resourceSet, typeProvider.getResourceSet()); }
@Test public void testCreateTypeProvider_03() { ClasspathTypeProvider typeProvider = factory.createTypeProvider(); ResourceSet resourceSet = typeProvider.getResourceSet(); Map<String, Object> map = resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap(); assertEquals(typeProvider, map.get(URIHelperConstants.PROTOCOL)); }
@Test public void testFindTypeProvider_02() { ResourceSet resourceSet = new ResourceSetImpl(); ClasspathTypeProvider typeProvider = factory.createTypeProvider(resourceSet); assertSame(typeProvider, factory.findTypeProvider(resourceSet)); }
@Before public void setUp() throws Exception { resourceSet = new ResourceSetImpl(); typeProvider = new ClasspathTypeProvider(getClass().getClassLoader(), resourceSet, null, null); }
protected ClasspathTypeProvider getTypeProvider() { return typeProvider; }
@Override public ClasspathBasedTypeScope createTypeScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter) { return new ClasspathBasedTypeScope((ClasspathTypeProvider) typeProvider, qualifiedNameConverter, filter); }
public ClasspathBasedTypeScope(ClasspathTypeProvider typeProvider, IQualifiedNameConverter qualifiedNameConverter, Predicate<IEObjectDescription> filter) { super(typeProvider, qualifiedNameConverter, filter); }
protected ClasspathTypeProvider createClasspathTypeProvider(ResourceSet resourceSet) { return new ClasspathTypeProvider(getClassLoader(resourceSet), resourceSet, getIndexedJvmTypeAccess(), services); }
@Override public ClasspathTypeProvider createTypeProvider() { return (ClasspathTypeProvider) super.createTypeProvider(); }
@Override protected ClasspathTypeProvider createClasspathTypeProvider(ResourceSet resourceSet) { return new ClasspathTypeProvider(new ActionClassLoader(super.getClassLoader()), resourceSet, getIndexedJvmTypeAccess()); }