public IScope getScope(Resource resource, EReference reference, Predicate<IEObjectDescription> filter) { if (resource == null) throw new IllegalStateException("context must be contained in a resource"); ResourceSet resourceSet = resource.getResourceSet(); if (resourceSet == null) throw new IllegalStateException("context must be contained in a resource set"); EClass referenceType = reference.getEReferenceType(); if (EcoreUtil2.isAssignableFrom(TypesPackage.Literals.JVM_TYPE, referenceType)) { IJvmTypeProvider typeProvider = getTypeProvider(resourceSet); return createTypeScope(typeProvider, filter); } else if (EcoreUtil2.isAssignableFrom(TypesPackage.Literals.JVM_CONSTRUCTOR, referenceType)) { IJvmTypeProvider typeProvider = getTypeProvider(resourceSet); return createConstructorScope(typeProvider, filter); } else { return IScope.NULLSCOPE; } }
@Override public IScope getScope(Resource resource, EReference reference, Predicate<IEObjectDescription> filter) { if (resource == null) throw new IllegalStateException("context must be contained in a resource"); ResourceSet resourceSet = resource.getResourceSet(); if (resourceSet == null) throw new IllegalStateException("context must be contained in a resource set"); EClass referenceType = reference.getEReferenceType(); if (EcoreUtil2.isAssignableFrom(TypesPackage.Literals.JVM_TYPE, referenceType)) { IJvmTypeProvider typeProvider = getTypeProvider(resourceSet); return createTypeScope(typeProvider, filter); } else if (EcoreUtil2.isAssignableFrom(TypesPackage.Literals.JVM_CONSTRUCTOR, referenceType)) { IJvmTypeProvider typeProvider = getTypeProvider(resourceSet); return createConstructorScope(typeProvider, filter); } else { return IScope.NULLSCOPE; } }
Resource resource = context.eResource(); IJvmTypeProvider typeProvider = typeScopeProvider.getTypeProvider(resource.getResourceSet()); AbstractTypeScope typeScope = typeScopeProvider.createTypeScope(typeProvider, null); IResourceDescriptions descriptions = resourceDescriptionsProvider.getResourceDescriptions(context.eResource().getResourceSet()); IResourceDescription resourceDescription = descriptions.getResourceDescription(resource.getURI());
@Override public AbstractScope get() { IJvmTypeProvider typeProvider = typeScopeProvider.getTypeProvider(resource.getResourceSet()); AbstractTypeScope typeScope = typeScopeProvider.createTypeScope(typeProvider, null); IResourceDescriptions descriptions = resourceDescriptionsProvider.getResourceDescriptions(context.eResource().getResourceSet()); IResourceDescription resourceDescription = descriptions.getResourceDescription(resource.getURI()); if (resourceDescription != null) { typeScope = new LocalResourceFilteringTypeScope(typeScope, resourceDescription); } RecordingTypeScope recordingTypeScope = new RecordingTypeScope(typeScope, getImportedNamesSet(resource), getQualifiedNameConverter()); AbstractScope rootTypeScope = getRootTypeScope(xtendFile, recordingTypeScope); AbstractScope importScope = getImportScope(xtendFile.getImportSection(), rootTypeScope, recordingTypeScope); AbstractScope localTypes = getResourceTypeScope(xtendFile.eResource(), xtendFile.getPackage(), importScope); AbstractScope primitiveAware = new PrimitiveAwareScope(localTypes, typeScope); AbstractScope caching = new CachingTypeScope(primitiveAware); return caching; } });