@Override
 protected void configure() {
   AnnotatedBindingBuilder<Resource.Factory> _bind =
       this.<Resource.Factory>bind(Resource.Factory.class);
   _bind.to(JavaResource.Factory.class);
   AnnotatedBindingBuilder<IResourceValidator> _bind_1 =
       this.<IResourceValidator>bind(IResourceValidator.class);
   _bind_1.toInstance(IResourceValidator.NULL);
   AnnotatedBindingBuilder<IGenerator> _bind_2 = this.<IGenerator>bind(IGenerator.class);
   _bind_2.to(IGenerator.NullGenerator.class);
   AnnotatedBindingBuilder<IEncodingProvider> _bind_3 =
       this.<IEncodingProvider>bind(IEncodingProvider.class);
   _bind_3.to(IEncodingProvider.Runtime.class);
   AnnotatedBindingBuilder<IResourceServiceProvider> _bind_4 =
       this.<IResourceServiceProvider>bind(IResourceServiceProvider.class);
   _bind_4.to(JavaResourceServiceProvider.class);
   AnnotatedBindingBuilder<IContainer.Manager> _bind_5 =
       this.<IContainer.Manager>bind(IContainer.Manager.class);
   _bind_5.to(SimpleResourceDescriptionsBasedContainerManager.class);
   AnnotatedBindingBuilder<IResourceDescription.Manager> _bind_6 =
       this.<IResourceDescription.Manager>bind(IResourceDescription.Manager.class);
   _bind_6.to(JavaResourceDescriptionManager.class);
   AnnotatedBindingBuilder<IQualifiedNameProvider> _bind_7 =
       this.<IQualifiedNameProvider>bind(IQualifiedNameProvider.class);
   _bind_7.to(JvmIdentifiableQualifiedNameProvider.class);
   AnnotatedBindingBuilder<String> _bind_8 = this.<String>bind(String.class);
   Named _named = Names.named(Constants.FILE_EXTENSIONS);
   LinkedBindingBuilder<String> _annotatedWith = _bind_8.annotatedWith(_named);
   _annotatedWith.toInstance("java");
   AnnotatedBindingBuilder<String> _bind_9 = this.<String>bind(String.class);
   Named _named_1 = Names.named(Constants.LANGUAGE_NAME);
   LinkedBindingBuilder<String> _annotatedWith_1 = _bind_9.annotatedWith(_named_1);
   _annotatedWith_1.toInstance("org.eclipse.xtext.java.Java");
   AnnotatedBindingBuilder<IJvmTypeProvider.Factory> _bind_10 =
       this.<IJvmTypeProvider.Factory>bind(IJvmTypeProvider.Factory.class);
   _bind_10.to(ClasspathTypeProviderFactory.class);
   AnnotatedBindingBuilder<ClassLoader> _bind_11 = this.<ClassLoader>bind(ClassLoader.class);
   ClassLoader _classLoader = JavaSourceLanguageRuntimeModule.class.getClassLoader();
   _bind_11.toInstance(_classLoader);
   AnnotatedBindingBuilder<IReferableElementsUnloader> _bind_12 =
       this.<IReferableElementsUnloader>bind(IReferableElementsUnloader.class);
   _bind_12.to(IReferableElementsUnloader.GenericUnloader.class);
   AnnotatedBindingBuilder<IResourceDescriptionsProvider> _bind_13 =
       this.<IResourceDescriptionsProvider>bind(IResourceDescriptionsProvider.class);
   final IResourceDescriptionsProvider _function =
       new IResourceDescriptionsProvider() {
         @Override
         public IResourceDescriptions getResourceDescriptions(final ResourceSet it) {
           return ChunkedResourceDescriptions.findInEmfObject(it);
         }
       };
   _bind_13.toInstance(_function);
 }
Exemplo n.º 2
0
 public void configureHighlightingTokenDefProvider(final Binder binder) {
   AnnotatedBindingBuilder<ITokenDefProvider> _bind =
       binder.<ITokenDefProvider>bind(ITokenDefProvider.class);
   Named _named = Names.named(LexerIdeBindings.HIGHLIGHTING);
   LinkedBindingBuilder<ITokenDefProvider> _annotatedWith = _bind.annotatedWith(_named);
   _annotatedWith.to(AntlrTokenDefProvider.class);
 }
Exemplo n.º 3
0
 public void configureLanguageSpecificPsiModelAssociations(final Binder binder) {
   AnnotatedBindingBuilder<IPsiModelAssociations> _bind =
       binder.<IPsiModelAssociations>bind(IPsiModelAssociations.class);
   LinkedBindingBuilder<IPsiModelAssociations> _annotatedWith =
       _bind.annotatedWith(LanguageSpecific.class);
   _annotatedWith.to(PsiModelAssociations.class);
 }
Exemplo n.º 4
0
 @Override
 @SuppressWarnings("unchecked")
 protected void configure() {
   // Bind mock controllet to this instance, to automatically replay/verify all mocks created by
   // runner.
   bind(MockController.class).toInstance(this);
   // map field values by type
   for (Field field : fields.keySet()) {
     TypeLiteral literal = TypeLiteral.get(field.getGenericType());
     AnnotatedBindingBuilder builder = bind(literal);
     // Check field annotations.
     Annotation[] fieldAnnotations = field.getAnnotations();
     for (Annotation annotation : fieldAnnotations) {
       Class<? extends Annotation> annotationType = annotation.annotationType();
       if (
       /* annotationType.isAnnotationPresent(Qualifier.class)|| */ annotationType
           .isAnnotationPresent(BindingAnnotation.class)) {
         builder.annotatedWith(annotation);
       }
       if (annotationType.isAnnotationPresent(ScopeAnnotation.class)) {
         builder.in(annotationType);
       }
     }
     Binding binding = fields.get(field);
     if (null != binding.getValue()) {
       builder.toInstance(binding.getValue());
     } else if (null != binding.getImplementation()) {
       builder.to(binding.getImplementation());
     } else if (null != binding.getProvider()) {
       builder.toProvider(binding.getProvider());
     }
   }
 }
 @SuppressWarnings({"unchecked", "rawtypes"})
 @Before
 public void before() {
   binder = mock(PrivateBinder.class);
   AnnotatedBindingBuilder ab = mock(AnnotatedBindingBuilder.class);
   when(binder.bind(any(Class.class))).thenReturn(ab);
   when(ab.annotatedWith(any(Annotation.class))).thenReturn(ab);
   AnnotatedElementBuilder aeb = mock(AnnotatedElementBuilder.class);
   when(binder.expose(any(Class.class))).thenReturn(aeb);
   ScopedBindingBuilder sb = mock(ScopedBindingBuilder.class);
   when(ab.toProvider(any(Class.class))).thenReturn(sb);
   when(binder.bind(any(TypeLiteral.class))).thenReturn(ab);
   when(binder.skipSources(any(Class.class), any(Class.class))).thenReturn(binder);
   securityConfigurer = mock(SeedSecurityConfigurer.class);
   underTest =
       new SecurityInternalModule(
           securityConfigurer, new HashMap<String, Class<? extends Scope>>());
   Whitebox.setInternalState(underTest, "binder", binder);
 }
Exemplo n.º 6
0
 public ScopedBindingBuilder configureContentAssistLexer(final Binder binder) {
   AnnotatedBindingBuilder<Lexer> _bind = binder.<Lexer>bind(Lexer.class);
   Named _named = Names.named(LexerIdeBindings.CONTENT_ASSIST);
   LinkedBindingBuilder<Lexer> _annotatedWith = _bind.annotatedWith(_named);
   return _annotatedWith.to(InternalEntitiesLexer.class);
 }
Exemplo n.º 7
0
 public void configureGlobalModificationTracker(final Binder binder) {
   AnnotatedBindingBuilder<Key> _bind = binder.<Key>bind(Key.class);
   Named _named = Names.named(BaseXtextFile.GLOBAL_MODIFICATION_COUNT);
   LinkedBindingBuilder<Key> _annotatedWith = _bind.annotatedWith(_named);
   _annotatedWith.toInstance(PsiModificationTracker.MODIFICATION_COUNT);
 }