org.eclipse.xtext.util.UriUtil Java Examples
The following examples show how to use
org.eclipse.xtext.util.UriUtil.
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: XProjectManager.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** @return all resource descriptions that start with the given prefix */ public List<URI> findResourcesStartingWithPrefix(URI prefix) { ResourceDescriptionsData resourceDescriptionsData = fullIndex.getContainer(projectDescription.getName()); // TODO: Moving this into ResourceDescriptionsData and using a sorted Map could increase performance List<URI> uris = new ArrayList<>(); for (URI uri : resourceDescriptionsData.getAllURIs()) { if (UriUtil.isPrefixOf(prefix, uri)) { uris.add(uri); } } return uris; }
Example #2
Source File: XBuildRequest.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** Return the base dir. */ public URI getBaseDir() { if ((this.baseDir == null)) { String userDir = System.getProperty("user.dir"); this.baseDir = UriUtil.createFolderURI(new File(userDir)); } return this.baseDir; }
Example #3
Source File: AbstractFileSystemSupport.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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; }
Example #4
Source File: BuildRequest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public URI getBaseDir() { if (baseDir == null) { String userDir = System.getProperty("user.dir"); baseDir = UriUtil.createFolderURI(new File(userDir)); } return baseDir; }
Example #5
Source File: ProjectConfig.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public ISourceFolder findSourceFolderContaining(URI member) { for (ISourceFolder f : sourceFolders) { if (UriUtil.isPrefixOf(this.path, member)) { return f; } } return null; }
Example #6
Source File: XtendBatchCompiler.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
/** * @since 2.8 */ public void setBasePath(String basePath) { this.baseURI = UriUtil.createFolderURI(new File(basePath)); }
Example #7
Source File: FileProjectConfig.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public FileProjectConfig(URI path, String name, IWorkspaceConfig workspaceConfig) { this.path = UriUtil.toFolderURI(path); this.name = name; this.workspaceConfig = (workspaceConfig != null) ? workspaceConfig : new WorkspaceConfig(this); }
Example #8
Source File: FileProjectConfig.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public FileProjectConfig(File root, String name, IWorkspaceConfig workspaceConfig) { this(UriUtil.createFolderURI(root), name, workspaceConfig); }
Example #9
Source File: FileProjectConfig.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public FileProjectConfig(File root, IWorkspaceConfig workspaceConfig) { this(UriUtil.createFolderURI(root), root.getName(), workspaceConfig); }
Example #10
Source File: ISourceFolder.java From xtext-core with Eclipse Public License 2.0 | 2 votes |
/** * @param uri * to check * @return true iff the given {@link URI} is a sub element of the {@link URI} of this {@link ISourceFolder}. */ default boolean contains(URI uri) { URI path = getPath(); return UriUtil.isPrefixOf(path, uri); }
Example #11
Source File: SarlBatchCompiler.java From sarl with Apache License 2.0 | 2 votes |
/** Change the base path. * * @param basePath the base path. */ public void setBasePath(String basePath) { setBaseURI(UriUtil.createFolderURI(normalizeFile(basePath))); }