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;
}
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;
}
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;
}
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);
}
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;
}
Aggregations