Java 类org.eclipse.xtext.common.types.access.IJvmTypeProvider 实例源码

项目:xtext-extras    文件:JavaSourceLanguageRuntimeModule.java   
@Override
protected void configure() {
  this.<Resource.Factory>bind(Resource.Factory.class).to(JavaResource.Factory.class);
  this.<IResourceValidator>bind(IResourceValidator.class).toInstance(IResourceValidator.NULL);
  this.<IGenerator>bind(IGenerator.class).to(IGenerator.NullGenerator.class);
  this.<IEncodingProvider>bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
  this.<IResourceServiceProvider>bind(IResourceServiceProvider.class).to(JavaResourceServiceProvider.class);
  this.<IContainer.Manager>bind(IContainer.Manager.class).to(SimpleResourceDescriptionsBasedContainerManager.class);
  this.<IResourceDescription.Manager>bind(IResourceDescription.Manager.class).to(JavaResourceDescriptionManager.class);
  this.<IQualifiedNameProvider>bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
  this.<String>bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("java");
  this.<String>bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.java.Java");
  this.<IJvmTypeProvider.Factory>bind(IJvmTypeProvider.Factory.class).to(ClasspathTypeProviderFactory.class);
  this.<ClassLoader>bind(ClassLoader.class).toInstance(JavaSourceLanguageRuntimeModule.class.getClassLoader());
  this.<IReferableElementsUnloader>bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.GenericUnloader.class);
  final IResourceDescriptionsProvider _function = (ResourceSet it) -> {
    return ChunkedResourceDescriptions.findInEmfObject(it);
  };
  this.<IResourceDescriptionsProvider>bind(IResourceDescriptionsProvider.class).toInstance(_function);
}
项目:xtext-extras    文件:TypeReferences.java   
/**
 * looks up a JVMType corresponding to the given {@link Class}. This method ignores any Jvm types created in non-
 * {@link TypeResource} in the given context's resourceSet, but goes straight to the Java-layer, using a
 * {@link IJvmTypeProvider}.
 * 
 * @return the JvmType with the same qualified name as the given {@link Class} object, or null if no such JvmType
 *         could be found using the context's resourceSet.
 */
public JvmType findDeclaredType(String typeName, Notifier context) {
    if (typeName == null)
        throw new NullPointerException("typeName");
    if (context == null)
        throw new NullPointerException("context");
    ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
    if (resourceSet == null)
        return null;
    // make sure a type provider is configured in the resource set. 
    IJvmTypeProvider typeProvider = typeProviderFactory.findOrCreateTypeProvider(resourceSet);
    try {
        final JvmType result = typeProvider.findTypeByName(typeName);
        return result;
    } catch (RuntimeException e) {
        operationCanceledManager.propagateAsErrorIfCancelException(e);
        log.info("Couldn't find JvmType for name '" + typeName + "' in context " + context, e);
        return null;
    }
}
项目:xtext-extras    文件:JvmTypeReferences.java   
public JvmParameterizedTypeReferenceConstructor(JvmType jvmType, TypesFactory typesFactory, IJvmTypeProvider typesProvider, JvmParameterizedTypeReferenceConstructor parent) {
    this.reference = typesFactory.createJvmParameterizedTypeReference();
    reference.setType(jvmType);
    this.typesFactory = typesFactory;
    this.typesProvider = typesProvider;
    this.parent  = parent;
}
项目:xtext-extras    文件:AbstractTypeScope.java   
protected AbstractTypeScope(IJvmTypeProvider typeProvider, IQualifiedNameConverter qualifiedNameConverter,
        Predicate<IEObjectDescription> filter) {
    super(IScope.NULLSCOPE, false);
    this.typeProvider = typeProvider;
    this.qualifiedNameConverter = qualifiedNameConverter;
    this.filter = filter;
}
项目:xtext-extras    文件:AnnotationLookup.java   
private JvmAnnotationType findAnnotationType(Class<? extends Annotation> type, Notifier context) {
    ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
    if (resourceSet == null)
        return null;
    IJvmTypeProvider typeProvider = typeProviderFactory.findOrCreateTypeProvider(resourceSet);
    try {
        final JvmType result = typeProvider.findTypeByName(type.getName());
        if (result instanceof JvmAnnotationType)
            return (JvmAnnotationType) result;
        return null;
    } catch (RuntimeException e) {
        return null;
    }
}
项目:dsl-devkit    文件:JdtFallbackTypeProviderFactory.java   
/** {@inheritDoc} */
@Override
public IJvmTypeProvider findTypeProvider(final ResourceSet resourceSet) {
  IJvmTypeProvider result = super.findTypeProvider(resourceSet);
  if ((result instanceof IJdtTypeProvider) && !(result instanceof JdtFallbackTypeProvider)) {
    return createBundleAwareDelegate((IJdtTypeProvider) result, resourceSet);
  }
  return result;
}
项目:openhab-hdl    文件:ScriptScopeProvider.java   
private Collection<? extends IEObjectDescription> createTypeFeatures(ResourceSet rs) {

    List<IEObjectDescription> descriptions = new ArrayList<IEObjectDescription>();
    IJvmTypeProvider provider = typeProviderFactory.findOrCreateTypeProvider(rs);
    for(Type type : stateAndCommandProvider.getAllTypes()) {
        descriptions.add(EObjectDescription.create(type.toString(), provider.findTypeByName(type.getClass().getCanonicalName())));
    }

    return descriptions;
}
项目:openhab-hdl    文件:ScriptScopeProvider.java   
private List<IEObjectDescription> createItemFeatures(ResourceSet rs) {
    IJvmTypeProvider provider = typeProviderFactory.findOrCreateTypeProvider(rs);
    List<IEObjectDescription> descriptions = new ArrayList<IEObjectDescription>();
    ItemRegistry itemRegistry = itemRegistryProvider.get();
    if(itemRegistry!=null) {
        for(Item item : itemRegistry.getItems()) {
            descriptions.add(EObjectDescription.create(item.getName(), provider.findTypeByName(item.getClass().getCanonicalName())));
        }
    }
    return descriptions;
}
项目:xtext-extras    文件:ReusedTypeProviderTest.java   
@Override
protected IJvmTypeProvider getTypeProvider() {
  return ReusedTypeProviderTest.typeProvider;
}
项目:xtext-extras    文件:ClasspathBasedModule.java   
public Class<? extends IJvmTypeProvider.Factory> bindIJvmTypeProvider$Factory() {
    return ClasspathTypeProviderFactory.class;
}
项目:xtext-extras    文件:JvmTypeReferences.java   
public JvmTypeReferences(TypesFactory typesFactory, IJvmTypeProvider typesProvider) {
    this.typesProvider = typesProvider;
    this.typesFactory = typesFactory;
}
项目:xtext-extras    文件:JvmTypeReferences.java   
public JvmParameterizedTypeReferenceConstructor(String qualifiedName, TypesFactory typesFactory, IJvmTypeProvider typesProvider, JvmParameterizedTypeReferenceConstructor parent) {
    this(typesProvider.findTypeByName(qualifiedName),typesFactory,typesProvider,parent);
}
项目:xtext-extras    文件:ClasspathBasedTypeScopeProvider.java   
@Override
public ClasspathBasedTypeScope createTypeScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter) {
    return new ClasspathBasedTypeScope((ClasspathTypeProvider) typeProvider, qualifiedNameConverter, filter);
}
项目:xtext-extras    文件:ClasspathBasedTypeScopeProvider.java   
@Override
public AbstractConstructorScope createConstructorScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter) {
    ClasspathBasedTypeScope typeScope = createTypeScope(typeProvider, filter);
    return new ClasspathBasedConstructorScope(typeScope);
}
项目:xtext-extras    文件:AbstractTypeScopeProvider.java   
public IJvmTypeProvider getTypeProvider(ResourceSet resourceSet) {
    IJvmTypeProvider typeProvider = getTypeProviderFactory().findOrCreateTypeProvider(resourceSet);
    return typeProvider;
}
项目:xtext-extras    文件:AbstractTypeScope.java   
public IJvmTypeProvider getTypeProvider() {
    return typeProvider;
}
项目:xtext-extras    文件:ReflectionTypeProviderFactory.java   
@Override
public IJvmTypeProvider findTypeProvider(ResourceSet resourceSet) {
    return super.findTypeProvider(resourceSet);
}
项目:xtext-extras    文件:ReflectionTypeScopeProvider.java   
@Override
public ReflectionTypeScope createTypeScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter) {
    return new ReflectionTypeScope((ReflectionTypeProvider) typeProvider, qualifiedNameConverter, filter);
}
项目:xtext-extras    文件:ReflectionTypeScopeProvider.java   
@Override
public AbstractConstructorScope createConstructorScope(IJvmTypeProvider typeProvider,
        Predicate<IEObjectDescription> filter) {
    ReflectionTypeScope typeScope = createTypeScope(typeProvider, filter);
    return new ReflectionConstructorScope(typeScope);
}
项目:xtext-extras    文件:DefaultCommonTypesRuntimeModule.java   
public Class<? extends IJvmTypeProvider.Factory> bindIJvmTypeProvider$Factory() {
    return ClasspathTypeProviderFactory.class;
}
项目:openhab-hdl    文件:ActionClasspathBasedTypeScopeProvider.java   
@Override
public ClasspathBasedTypeScope createTypeScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter) {
    return new ClasspathBasedTypeScope((ClasspathTypeProvider) typeProvider, qualifiedNameConverter, filter);
}
项目:openhab-hdl    文件:ActionClasspathBasedTypeScopeProvider.java   
@Override
public AbstractConstructorScope createConstructorScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter) {
    ClasspathBasedTypeScope typeScope = createTypeScope(typeProvider, filter);
    return new ClasspathBasedConstructorScope(typeScope);
}
项目:dsl-devkit    文件:JdtFallbackTypeProvider.java   
/**
 * Creates a new instance of {@link JdtFallbackTypeProvider}.
 *
 * @param first
 *          the first {@link IJdtTypeProvider}, may be {@code null}
 * @param second
 *          the second {@link IJvmTypeProvider}, must not be {@code null}
 */
public JdtFallbackTypeProvider(final IJdtTypeProvider first, final IJvmTypeProvider second) {
  this.first = first;
  this.second = second;
}
项目:dsl-devkit    文件:AbstractCheckContentAssistBugTest.java   
/**
 * Initializes the type provider used for accessing JvmTypes.
 *
 * @param set
 *          the resource set
 */
protected void initializeTypeProvider(final XtextResourceSet set) {
  IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
  typeProviderFactory.findOrCreateTypeProvider(set);
  set.setClasspathURIContext(getJavaProject(set));
}
项目:xtext-extras    文件:AbstractTypeProviderTest.java   
protected abstract IJvmTypeProvider getTypeProvider();
项目:xtext-extras    文件:AbstractTypeProviderTest.java   
protected abstract IJvmTypeProvider getTypeProvider();
项目:xtext-extras    文件:AbstractTypeProviderPerformanceTest.java   
protected abstract IJvmTypeProvider getTypeProvider();
项目:xtext-extras    文件:AbstractTypeScopeProvider.java   
public abstract AbstractTypeScope createTypeScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter);
项目:xtext-extras    文件:AbstractTypeScopeProvider.java   
public abstract AbstractConstructorScope createConstructorScope(IJvmTypeProvider typeProvider, Predicate<IEObjectDescription> filter);
项目:xtext-extras    文件:AbstractTypeScopeProvider.java   
public abstract IJvmTypeProvider.Factory getTypeProviderFactory();