Search in sources :

Example 1 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-xtend by eclipse.

the class AbstractFileSystemSupport method getURI.

protected URI getURI(final Path path) {
    if (((path == null) || Objects.equal(path, Path.ROOT))) {
        return null;
    }
    final IProjectConfig projectConfig = this.projectConfigProvider.getProjectConfig(this.context);
    if ((projectConfig == null)) {
        return null;
    }
    final URI projectURI = projectConfig.getPath();
    final String projectName = IterableExtensions.<String>head(path.getSegments());
    String _name = projectConfig.getName();
    boolean _notEquals = (!Objects.equal(projectName, _name));
    if (_notEquals) {
        return null;
    }
    final Iterable<String> segments = IterableExtensions.<String>tail(path.getSegments());
    boolean _isEmpty = IterableExtensions.isEmpty(segments);
    if (_isEmpty) {
        return projectURI;
    }
    final URI relativeURI = URI.createURI(IterableExtensions.<String>head(segments)).appendSegments(((String[]) Conversions.unwrapArray(IterableExtensions.<String>tail(segments), String.class)));
    final URI uri = relativeURI.resolve(projectURI);
    Boolean _isFolder = this.isFolder(uri);
    if ((_isFolder).booleanValue()) {
        return UriUtil.toFolderURI(uri);
    }
    return uri;
}
Also used : IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig) URI(org.eclipse.emf.common.util.URI)

Example 2 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class ProjectConfigProvider method getProjectConfig.

@Override
public IProjectConfig getProjectConfig(final ResourceSet context) {
    ProjectConfigAdapter _findInEmfObject = ProjectConfigAdapter.findInEmfObject(context);
    IProjectConfig _projectConfig = null;
    if (_findInEmfObject != null) {
        _projectConfig = _findInEmfObject.getProjectConfig();
    }
    return _projectConfig;
}
Also used : IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig) ProjectConfigAdapter(org.eclipse.xtext.workspace.ProjectConfigAdapter)

Example 3 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-xtend by eclipse.

the class FileLocationsImpl method getProjectConfig.

protected IProjectConfig getProjectConfig(final Path path) {
    final String firstSegment = path.getSegments().get(0);
    final IProjectConfig projectConfig = this.projectInformationProvider.getProjectConfig(this.context.getResourceSet());
    if (((projectConfig == null) || (!Objects.equal(projectConfig.getName(), firstSegment)))) {
        throw new IllegalArgumentException((("The project \'" + firstSegment) + "\' has not been configured."));
    }
    return projectConfig;
}
Also used : IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 4 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class WorkspaceManager method getProjectManager.

public ProjectManager getProjectManager(final URI uri) {
    final IProjectConfig projectConfig = this.getWorkspaceConfig().findProjectContaining(uri);
    String _name = null;
    if (projectConfig != null) {
        _name = projectConfig.getName();
    }
    return this.projectName2ProjectManager.get(_name);
}
Also used : IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig)

Example 5 with IProjectConfig

use of org.eclipse.xtext.workspace.IProjectConfig in project xtext-core by eclipse.

the class WorkspaceManager method getProjectBaseDir.

public URI getProjectBaseDir(final URI uri) {
    final IProjectConfig projectConfig = this.getWorkspaceConfig().findProjectContaining(uri);
    URI _path = null;
    if (projectConfig != null) {
        _path = projectConfig.getPath();
    }
    return _path;
}
Also used : IProjectConfig(org.eclipse.xtext.workspace.IProjectConfig) URI(org.eclipse.emf.common.util.URI)

Aggregations

IProjectConfig (org.eclipse.xtext.workspace.IProjectConfig)10 URI (org.eclipse.emf.common.util.URI)2 IWorkspaceConfig (org.eclipse.xtext.workspace.IWorkspaceConfig)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 AbstractTraceRegion (org.eclipse.xtext.generator.trace.AbstractTraceRegion)1 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)1 IResourceDescriptions (org.eclipse.xtext.resource.IResourceDescriptions)1 ResourceSetBasedResourceDescriptions (org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions)1 ITextRegionWithLineInformation (org.eclipse.xtext.util.ITextRegionWithLineInformation)1 ISourceFolder (org.eclipse.xtext.workspace.ISourceFolder)1 ProjectConfigAdapter (org.eclipse.xtext.workspace.ProjectConfigAdapter)1