org.eclipse.xtext.XtextRuntimeModule Java Examples
The following examples show how to use
org.eclipse.xtext.XtextRuntimeModule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GrammarAccessExtensions2Test.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override public Injector getInjector() { Injector _xblockexpression = null; { TerminalsStandaloneSetup.doSetup(); XtextRuntimeModule _xtextRuntimeModule = new XtextRuntimeModule(); _xblockexpression = Guice.createInjector(_xtextRuntimeModule, new com.google.inject.Module() { @Override public void configure(final Binder binder) { AnnotatedBindingBuilder<IXtextProjectConfig> _bind = binder.<IXtextProjectConfig>bind(IXtextProjectConfig.class); StandardProjectConfig _standardProjectConfig = new StandardProjectConfig(); _bind.toInstance(_standardProjectConfig); } }); } return _xblockexpression; }
Example #2
Source File: AbstractGeneratorFragmentTests.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
public <T extends AbstractXtextGeneratorFragment> T initializeFragmentWithGrammarFromString(final Class<T> fragmentClass, final String grammarString) { try { if ((this.rs == null)) { this.rs = this.<XtextResourceSet>get(XtextResourceSet.class); } final XtextResource resource = this.getResourceFromString(grammarString); EObject _head = IterableExtensions.<EObject>head(resource.getContents()); final Grammar grammar = ((Grammar) _head); XtextRuntimeModule _xtextRuntimeModule = new XtextRuntimeModule(); AbstractGeneratorFragmentTests.FragmentGeneratorModule _fragmentGeneratorModule = new AbstractGeneratorFragmentTests.FragmentGeneratorModule(grammar); final Injector generatorInjector = Guice.createInjector( Modules2.mixin(_xtextRuntimeModule, _fragmentGeneratorModule)); final Xtext2EcoreTransformer transformer = new Xtext2EcoreTransformer(grammar); transformer.transform(); final AbstractGeneratorFragmentTests.FakeEMFGeneratorFragment2 emfGeneratorFragment = generatorInjector.<AbstractGeneratorFragmentTests.FakeEMFGeneratorFragment2>getInstance(AbstractGeneratorFragmentTests.FakeEMFGeneratorFragment2.class); emfGeneratorFragment.initialize(generatorInjector); emfGeneratorFragment.getSaveAndReconcileGenModel(grammar, transformer.getGeneratedPackages(), resource.getResourceSet()); AbstractGeneratorFragmentTests.lang.setResourceSet(resource.getResourceSet()); this.rs = null; return generatorInjector.<T>getInstance(fragmentClass); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example #3
Source File: XtextContentAssistTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public ISetup doGetSetup() { return new XtextStandaloneSetup() { @Override public Injector createInjector() { return Guice.createInjector(Modules2.mixin(new XtextRuntimeModule(),new XtextUIModuleInternal(Activator.getDefault()) { @Override public void configureContentProposalLabelProvider(com.google.inject.Binder binder) { binder.bind(ILabelProvider.class).annotatedWith(ContentProposalLabelProvider.class).to(DefaultEObjectLabelProvider.class); } }, new SharedStateModule())); } }; }
Example #4
Source File: Issue1161Test.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public Injector createInjector() { XtextRuntimeModule module = new XtextRuntimeModule() { @SuppressWarnings("unused") public Class<? extends IPreferenceValuesProvider> bindIPreferenceValuesProvider() { return IPreferenceValuesProvider.SingletonPreferenceValuesProvider.class; } }; return Guice.createInjector(module); }
Example #5
Source File: AbstractSelectorFragmentProviderTest.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
@Before @Override public void setUp() throws Exception { super.setUp(); with(Modules2.mixin(new XtextRuntimeModule(), new AbstractModule() { @Override protected void configure() { bind(IFragmentProvider.class).to(TestSelectorFragmentProvider.class); } })); }
Example #6
Source File: ResourceNameTemplateVariableResolverTest.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
@BeforeAll public void beforeAll() { mockContext = Mockito.mock(XtextTemplateContext.class); mockDocument = Mockito.mock(IXtextDocument.class); mockFile = Mockito.mock(IFile.class); helper = Guice.createInjector(new XtextRuntimeModule()).getInstance(TemplateVariableResolverTestHelper.class); resolver = new ResourceNameTemplateVariableResolver(); Mockito.when(mockContext.getDocument()).thenReturn(mockDocument); Mockito.when(mockDocument.getAdapter(IFile.class)).thenReturn(mockFile); }
Example #7
Source File: Activator.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected com.google.inject.Module getRuntimeModule(String grammar) { if (ORG_ECLIPSE_XTEXT_XTEXT.equals(grammar)) { return new XtextRuntimeModule(); } throw new IllegalArgumentException(grammar); }
Example #8
Source File: XtextIdeSetup.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Injector createInjector() { return Guice.createInjector(Modules2.mixin(new XtextRuntimeModule(), new XtextIdeModule())); }
Example #9
Source File: SimpleEnumTemplateVariableResolverTest.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@BeforeAll public void beforeAll() { mockContext = mock(XtextTemplateContext.class); helper = Guice.createInjector(new XtextRuntimeModule()).getInstance(TemplateVariableResolverTestHelper.class); resolver = new SimpleEnumTemplateVariableResolver(); }