org.eclipse.emf.ecore.resource.URIHandler Java Examples

The following examples show how to use org.eclipse.emf.ecore.resource.URIHandler. 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: BuiltInSchemeRegistrar.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private boolean registerScheme(URIConverter converter, @SuppressWarnings("hiding") ClassLoader classLoader) {
	URIHandler uriHandler = converter.getURIHandlers().get(0);
	if (uriHandler instanceof MyURIHandler || uriHandler.canHandle(SAMPLE_URI)) {
		return false;
	}
	converter.getURIHandlers().add(0, createURIHandler(classLoader, converter));
	return true;
}
 
Example #2
Source File: N4SchemeURIBasedStorage.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public InputStream getContents() throws CoreException {
	URIHandler handler = schemeHelper.createURIHandler(URIConverter.INSTANCE);
	try {
		return handler.createInputStream(getURI(), Collections.emptyMap());
	} catch (IOException e) {
		throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.n4js.ts.ui", "Cannot load "
				+ getFullPath(), e));
	}
}
 
Example #3
Source File: ExternalContentSupport.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void configureConverter(URIConverter converter, IExternalContentProvider contentProvider) {
	List<URIHandler> uriHandlers = converter.getURIHandlers();
	ListIterator<URIHandler> iter = uriHandlers.listIterator();
	while(iter.hasNext()) {
		URIHandler transformed = new ExternalContentAwareURIHandler(iter.next(), contentProvider);
		iter.set(transformed);
	}
}
 
Example #4
Source File: ResourceServiceProviderRegistryImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected synchronized URIConverter getURIConverter() {
	if (this.uriConverter == null) {
		List<ContentHandler> withoutPlatformDelegate = Lists.newArrayList();
		for (ContentHandler contentHandler : ContentHandler.Registry.INSTANCE.contentHandlers()) {
			if (!isTooEager(contentHandler))
				withoutPlatformDelegate.add(contentHandler);
		}
		this.uriConverter = new ExtensibleURIConverterImpl(URIHandler.DEFAULT_HANDLERS, withoutPlatformDelegate);
	}
	return this.uriConverter;
}
 
Example #5
Source File: BuiltInSchemeRegistrar.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private URIHandler createURIHandler(ClassLoader theClassLoader, URIConverter converter) {
	return new MyURIHandler(theClassLoader, converter);
}
 
Example #6
Source File: BuiltInSchemeRegistrar.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates a new URI Handler for the n4scheme.
 */
public URIHandler createURIHandler(URIConverter converter) {
	return createURIHandler(classLoader, converter);
}
 
Example #7
Source File: EmptyAuthorityAddingNormalizer.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @see org.eclipse.emf.ecore.resource.URIConverter#getURIHandlers()
 */
@Override
public EList<URIHandler> getURIHandlers() {
	return delegate.getURIHandlers();
}
 
Example #8
Source File: EmptyAuthorityAddingNormalizer.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @see org.eclipse.emf.ecore.resource.URIConverter#getURIHandler(org.eclipse.emf.common.util.URI)
 */
@Override
public URIHandler getURIHandler(URI uri) {
	return delegate.getURIHandler(uri);
}
 
Example #9
Source File: ClasspathTypeProvider.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public EList<URIHandler> getURIHandlers() {
	return existing.getURIHandlers();
}
 
Example #10
Source File: ClasspathTypeProvider.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public URIHandler getURIHandler(URI uri) {
	return existing.getURIHandler(uri);
}
 
Example #11
Source File: ExternalContentSupport.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public ExternalContentAwareURIHandler(URIHandler delegate, IExternalContentProvider contentProvider) {
	this.delegate = delegate;
	this.contentProvider = contentProvider;
}
 
Example #12
Source File: ExternalContentSupportTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
private void checkConverter(URIConverter wrapped) {
	assertNotNull(wrapped);
	for(URIHandler handler: wrapped.getURIHandlers()) {
		assertTrue(handler instanceof ExternalContentSupport.ExternalContentAwareURIHandler);
	}
}