Search in sources :

Example 11 with ProjectDescription

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

the class ProjectDescriptionBasedContainerManager method getContainer.

@Override
public IContainer getContainer(final IResourceDescription desc, final IResourceDescriptions resourceDescriptions) {
    final ChunkedResourceDescriptions chunkedResourceDescriptions = this.getChunkedResourceDescriptions(resourceDescriptions);
    if ((chunkedResourceDescriptions == null)) {
        String _name = ChunkedResourceDescriptions.class.getName();
        String _plus = ("expected " + _name);
        throw new IllegalArgumentException(_plus);
    }
    final ResourceSet resourceSet = chunkedResourceDescriptions.getResourceSet();
    final ProjectDescription projectDescription = ProjectDescription.findInEmfObject(resourceSet);
    final IContainer container = this.createContainer(resourceDescriptions, chunkedResourceDescriptions, projectDescription.getName());
    return container;
}
Also used : LiveShadowedChunkedResourceDescriptions(org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions) ChunkedResourceDescriptions(org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IContainer(org.eclipse.xtext.resource.IContainer) ProjectDescription(org.eclipse.xtext.resource.impl.ProjectDescription)

Example 12 with ProjectDescription

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

the class ProjectDescriptionBasedContainerManager method getVisibleContainers.

@Override
public List<IContainer> getVisibleContainers(final IResourceDescription desc, final IResourceDescriptions resourceDescriptions) {
    final ChunkedResourceDescriptions chunkedResourceDescriptions = this.getChunkedResourceDescriptions(resourceDescriptions);
    if ((chunkedResourceDescriptions == null)) {
        String _name = ChunkedResourceDescriptions.class.getName();
        String _plus = ("expected " + _name);
        throw new IllegalArgumentException(_plus);
    }
    final ResourceSet resourceSet = chunkedResourceDescriptions.getResourceSet();
    final ProjectDescription projectDescription = ProjectDescription.findInEmfObject(resourceSet);
    final ArrayList<IContainer> allContainers = CollectionLiterals.<IContainer>newArrayList();
    allContainers.add(this.createContainer(resourceDescriptions, chunkedResourceDescriptions, projectDescription.getName()));
    List<String> _dependencies = projectDescription.getDependencies();
    for (final String name : _dependencies) {
        allContainers.add(this.createContainer(resourceDescriptions, chunkedResourceDescriptions, name));
    }
    return allContainers;
}
Also used : LiveShadowedChunkedResourceDescriptions(org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions) ChunkedResourceDescriptions(org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IContainer(org.eclipse.xtext.resource.IContainer) ProjectDescription(org.eclipse.xtext.resource.impl.ProjectDescription)

Aggregations

ProjectDescription (org.eclipse.xtext.resource.impl.ProjectDescription)12 TopologicalSorter (org.eclipse.xtext.ide.server.TopologicalSorter)6 Test (org.junit.Test)6 ChunkedResourceDescriptions (org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions)3 URI (org.eclipse.emf.common.util.URI)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 IContainer (org.eclipse.xtext.resource.IContainer)2 LiveShadowedChunkedResourceDescriptions (org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 URIHandler (org.eclipse.emf.ecore.resource.URIHandler)1 BuildRequest (org.eclipse.xtext.build.BuildRequest)1 IndexState (org.eclipse.xtext.build.IndexState)1 Source2GeneratedMapping (org.eclipse.xtext.build.Source2GeneratedMapping)1 ProjectManager (org.eclipse.xtext.ide.server.ProjectManager)1 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 ResourceDescriptionsData (org.eclipse.xtext.resource.impl.ResourceDescriptionsData)1 InMemoryURIHandler (org.eclipse.xtext.testing.util.InMemoryURIHandler)1 Issue (org.eclipse.xtext.validation.Issue)1