org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions Java Examples

The following examples show how to use org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions. 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: DelegatingReferenceFinderTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void setUp() throws Exception {
	super.setUp();
	with(RefactoringTestLanguageStandaloneSetup.class);
	resourceSet = get(XtextResourceSet.class);
	resource = loadResource("test.refactoringtestlanguage", "A { B { ref A } } C");
	elementA = resource.getContents().get(0).eContents().get(0);
	elementB = elementA.eContents().get(0);
	elementC = resource.getContents().get(0).eContents().get(1);
	resourceSet.getResources().add(resource);

	ResourceSetBasedResourceDescriptions resourceDescriptions = get(ResourceSetBasedResourceDescriptions.class);
	resourceDescriptions.setContext(resourceSet);
	referenceFinder = new DelegatingReferenceFinder();
	referenceFinder.setIndexData(resourceDescriptions);
	referenceFinder.setConverter(get(TargetURIConverter.class));
	referenceFinder.setDelegate(get(org.eclipse.xtext.findReferences.IReferenceFinder.class));
	referenceFinder.setResourceServiceProviderRegistry(get(IResourceServiceProvider.Registry.class));
	localResourceAccess = new SimpleLocalResourceAccess(resourceSet);
	acceptor = new CheckingAcceptor();
}
 
Example #2
Source File: DefaultReferenceFinderTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void setUp() throws Exception {
	super.setUp();
	with(RefactoringTestLanguageStandaloneSetup.class);
	resourceSet = get(XtextResourceSet.class);
	resource = loadResource("test.refactoringtestlanguage", "A { B { ref A } } C");
	elementA = resource.getContents().get(0).eContents().get(0);
	elementB = elementA.eContents().get(0);
	elementC = resource.getContents().get(0).eContents().get(1);
	resourceSet.getResources().add(resource);

	ResourceSetBasedResourceDescriptions resourceDescriptions = get(ResourceSetBasedResourceDescriptions.class);
	resourceDescriptions.setContext(resourceSet);
	referenceFinder = new DefaultReferenceFinder(resourceDescriptions, get(IResourceServiceProvider.Registry.class), get(TargetURIConverter.class));
	localResourceAccess = new SimpleLocalResourceAccess(resourceSet);
	acceptor = new CheckingAcceptor();
}
 
Example #3
Source File: BuilderIntegrationFragment.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
	return new BindFactory()
	.addTypeToType(IContainer.Manager.class.getName(), StateBasedContainerManager.class.getName())
	.addTypeToType(IAllContainersState.Provider.class.getName(),
			org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider.class.getName())
	.addConfiguredBinding(
				IResourceDescriptions.class.getName(),
				"binder.bind(" + IResourceDescriptions.class.getName() + ".class"
						+ ").to("
						+ ResourceSetBasedResourceDescriptions.class.getName() + ".class)")
		.addConfiguredBinding(
				IResourceDescriptions.class.getName() + "Persisted",
				"binder.bind("+ IResourceDescriptions.class.getName() + ".class"
						+ ").annotatedWith(com.google.inject.name.Names.named("
						+ "org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to("
						+ ResourceSetBasedResourceDescriptions.class.getName() + ".class)")
		.getBindings();
}
 
Example #4
Source File: LiveShadowedAllContainerStateTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testContainsURI() {
	String fileExtension = fep.getPrimaryFileExtension();
	XtextResourceSet xtextResourceSet1 = rsp.get();
	xtextResourceSet1.createResource(URI.createURI("/a/x." + fileExtension));
	xtextResourceSet1.createResource(URI.createURI("/b/x1." + fileExtension));
	ResourceSetBasedResourceDescriptions liveState = new ResourceSetBasedResourceDescriptions();
	liveState.setContext(xtextResourceSet1);
	liveState.setRegistry(registry);
	Multimap<String, URI> container2Uris = ArrayListMultimap.create();
	container2Uris.put("a", URI.createURI("/a/x." + fileExtension));
	container2Uris.put("a", URI.createURI("/a/y." + fileExtension));
	container2Uris.put("b", URI.createURI("/b/x1." + fileExtension));
	container2Uris.put("b", URI.createURI("/b/x2." + fileExtension));
	IAllContainersState containersState = containerStateProvider.get(liveState,
			new FakeAllContainerState(container2Uris));
	assertTrue(containersState.containsURI("a", URI.createURI("/a/x." + fileExtension)));
	assertTrue(containersState.containsURI("a", URI.createURI("/a/y." + fileExtension)));
	assertFalse(containersState.containsURI("b", URI.createURI("/a/x." + fileExtension)));
	assertFalse(containersState.containsURI("b", URI.createURI("/a/y." + fileExtension)));
	assertTrue(containersState.containsURI("b", URI.createURI("/b/x1." + fileExtension)));
	assertTrue(containersState.containsURI("b", URI.createURI("/b/x2." + fileExtension)));
	assertFalse(containersState.containsURI("a", URI.createURI("/b/x1." + fileExtension)));
	assertFalse(containersState.containsURI("a", URI.createURI("/b/x2." + fileExtension)));
}
 
Example #5
Source File: ModelSequencerTest.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() {
	Module m = new Module() {
		@Override
		public void configure(Binder binder) {
			binder.bind(INamingService.class).to(DefaultNamingService.class);
			binder.bind(IQualifiedNameProvider.class).to(SGraphNameProvider.class);
			binder.bind(ITypeSystem.class).toInstance(GenericTypeSystem.getInstance());
			binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
			binder.bind(String.class).annotatedWith(Names.named("Separator")).toInstance("_");
		}
	};
	Injector injector = Guice.createInjector(m);
	injector.injectMembers(this);
}
 
Example #6
Source File: AbstractXtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #7
Source File: AbstractArithmeticsRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #8
Source File: AbstractXtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #9
Source File: XtendBatchCompiler.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected ResourceSetBasedResourceDescriptions getResourceDescriptions(ResourceSet resourceSet) {
	ResourceSetBasedResourceDescriptions resourceDescriptions = resourceSetDescriptionsProvider.get();
	resourceDescriptions.setContext(resourceSet);
	resourceDescriptions.setRegistry(IResourceServiceProvider.Registry.INSTANCE);
	return resourceDescriptions;
}
 
Example #10
Source File: ResourceDescriptionsProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public IResourceDescriptions get(ResourceSet resourceSet) {
	ResourceSetBasedResourceDescriptions descriptions = new ResourceSetBasedResourceDescriptions();
	descriptions.setContext(resourceSet);
	descriptions.setRegistry(IResourceServiceProvider.Registry.INSTANCE);
	return descriptions;
}
 
Example #11
Source File: AbstractNestedRefsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #12
Source File: AbstractGamlRuntimeModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #13
Source File: AbstractTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #14
Source File: AbstractTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #15
Source File: AbstractFileAwareTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #16
Source File: AbstractLiveContainerBuilderIntegerationTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #17
Source File: AbstractBeeLangTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #18
Source File: AbstractXtextGrammarTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #19
Source File: AbstractBuilderTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #20
Source File: AbstractBuilderTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #21
Source File: DefaultRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsLiveScope(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #22
Source File: AbstractArithmeticsRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #23
Source File: AbstractRuleEngineRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #24
Source File: AbstractRuleEngineRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #25
Source File: GenericSimulationModule.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IResourceDescriptions> bindIResourceDescriptions() {
	return ResourceSetBasedResourceDescriptions.class;
}
 
Example #26
Source File: AbstractStatemachineRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #27
Source File: AbstractDomainmodelRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #28
Source File: AbstractDomainmodelRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #29
Source File: AbstractEcore2XtextTestRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptionsPersisted(Binder binder) {
	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class);
}
 
Example #30
Source File: AbstractEcore2XtextTestRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureIResourceDescriptions(Binder binder) {
	binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class);
}