Search in sources :

Example 1 with ResourceSetBasedResourceDescriptions

use of org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions in project xtext-xtend by eclipse.

the class XtendBatchCompiler method getResourceDescriptions.

protected ResourceSetBasedResourceDescriptions getResourceDescriptions(ResourceSet resourceSet) {
    ResourceSetBasedResourceDescriptions resourceDescriptions = resourceSetDescriptionsProvider.get();
    resourceDescriptions.setContext(resourceSet);
    resourceDescriptions.setRegistry(IResourceServiceProvider.Registry.INSTANCE);
    return resourceDescriptions;
}
Also used : ResourceSetBasedResourceDescriptions(org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions)

Example 2 with ResourceSetBasedResourceDescriptions

use of org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions in project xtext-core by eclipse.

the class LiveShadowedAllContainerStateTest method testContainsURI.

@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)));
}
Also used : ResourceSetBasedResourceDescriptions(org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) URI(org.eclipse.emf.common.util.URI) Test(org.junit.Test)

Example 3 with ResourceSetBasedResourceDescriptions

use of org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions in project xtext-core by eclipse.

the class ResourceDescriptionsProvider method get.

public IResourceDescriptions get(ResourceSet resourceSet) {
    ResourceSetBasedResourceDescriptions descriptions = new ResourceSetBasedResourceDescriptions();
    descriptions.setContext(resourceSet);
    descriptions.setRegistry(IResourceServiceProvider.Registry.INSTANCE);
    return descriptions;
}
Also used : ResourceSetBasedResourceDescriptions(org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions)

Example 4 with ResourceSetBasedResourceDescriptions

use of org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions in project xtext-core by eclipse.

the class LiveShadowedChunkedResourceDescriptions method setContext.

@Override
public void setContext(final Notifier ctx) {
    IResourceDescriptions _localDescriptions = this.getLocalDescriptions();
    final Procedure1<ResourceSetBasedResourceDescriptions> _function = (ResourceSetBasedResourceDescriptions it) -> {
        it.setContext(ctx);
        it.setData(null);
    };
    ObjectExtensions.<ResourceSetBasedResourceDescriptions>operator_doubleArrow(((ResourceSetBasedResourceDescriptions) _localDescriptions), _function);
    final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
    this.setGlobalDescriptions(ChunkedResourceDescriptions.findInEmfObject(resourceSet));
    IProjectConfig _projectConfig = null;
    if (this.projectConfigProvider != null) {
        _projectConfig = this.projectConfigProvider.getProjectConfig(resourceSet);
    }
    IWorkspaceConfig _workspaceConfig = null;
    if (_projectConfig != null) {
        _workspaceConfig = _projectConfig.getWorkspaceConfig();
    }
    this.workspaceConfig = _workspaceConfig;
}
Also used : ResourceSetBasedResourceDescriptions(org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions) IResourceDescriptions(org.eclipse.xtext.resource.IResourceDescriptions) IWorkspaceConfig(org.eclipse.xtext.workspace.IWorkspaceConfig) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 5 with ResourceSetBasedResourceDescriptions

use of org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions in project xtext-eclipse by eclipse.

the class DefaultReferenceFinderTest method setUp.

@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();
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) ResourceSetBasedResourceDescriptions(org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) SimpleLocalResourceAccess(org.eclipse.xtext.ui.editor.findrefs.SimpleLocalResourceAccess) DefaultReferenceFinder(org.eclipse.xtext.ui.editor.findrefs.DefaultReferenceFinder)

Aggregations

ResourceSetBasedResourceDescriptions (org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions)6 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)3 SimpleLocalResourceAccess (org.eclipse.xtext.ui.editor.findrefs.SimpleLocalResourceAccess)2 URI (org.eclipse.emf.common.util.URI)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 IResourceDescriptions (org.eclipse.xtext.resource.IResourceDescriptions)1 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)1 DefaultReferenceFinder (org.eclipse.xtext.ui.editor.findrefs.DefaultReferenceFinder)1 DelegatingReferenceFinder (org.eclipse.xtext.ui.editor.findrefs.DelegatingReferenceFinder)1 IReferenceFinder (org.eclipse.xtext.ui.editor.findrefs.IReferenceFinder)1 TargetURIConverter (org.eclipse.xtext.ui.editor.findrefs.TargetURIConverter)1 IProjectConfig (org.eclipse.xtext.workspace.IProjectConfig)1 IWorkspaceConfig (org.eclipse.xtext.workspace.IWorkspaceConfig)1 Test (org.junit.Test)1