Java Code Examples for org.eclipse.emf.common.util.URI#hasAuthority()

The following examples show how to use org.eclipse.emf.common.util.URI#hasAuthority() . 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: URIUtils.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Adds empty authority to the given URI. Necessary for windows platform. */
public static URI addEmptyAuthority(URI uri) {
	if (uri.isFile() && !uri.hasAuthority() && !uri.isRelative()) {
		uri = URI.createHierarchicalURI(uri.scheme(), "", uri.device(), uri.segments(), uri.query(),
				uri.fragment());
	}
	return uri;
}
 
Example 2
Source File: ContributingResourceDescriptionPersister.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private IResourceDescription detectOutdated(IResourceDescription description) {
	URI uri = description.getURI();
	if (uri.isFile() && uri.scheme() != null && !uri.hasAuthority()) {
		throw new RuntimeException("Outdated index information");
	}
	return description;
}
 
Example 3
Source File: N4JSResource.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setURI(URI uri) {
	if (uri != null) {
		if (uri.isFile() && !uri.isRelative()) {
			if (!uri.hasAuthority()) {
				throw new IllegalArgumentException("File URI without authority: " + uri);
			}
		}
	}
	super.setURI(uri);
}