Java Code Examples for org.eclipse.xtext.resource.XtextResource#setValidationDisabled()

The following examples show how to use org.eclipse.xtext.resource.XtextResource#setValidationDisabled() . These examples are extracted from open source projects. 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
@Override
protected Resource createResourceFor(IStorage storage) throws CoreException {
	if (storage instanceof IURIBasedStorage) {
		URI uri = ((IURIBasedStorage) storage).getURI();
		ResourceSet resourceSet = getResourceSet(uri);
		configureResourceSet(resourceSet, uri);
		XtextResource resource = (XtextResource) getResourceFactory().createResource(uri);
		resourceSet.getResources().add(resource);
		resource.setValidationDisabled(isValidationDisabled(uri, storage));
		return resource;
	} else {
		return super.createResourceFor(storage);
	}
}
 
Example 2
protected Resource createResourceFor(IJarEntryResource storage) {
	ResourceSet resourceSet = getResourceSet(storage);
	URI uri = storageToUriMapper.getUri(storage);
	if (uri == null) {
		return null;
	}
	configureResourceSet(resourceSet, uri);
	XtextResource resource = createResource(resourceSet, uri);
	resource.setValidationDisabled(isValidationDisabled(uri, storage));
	return resource;
}
 
Example 3
/**
 * @since 2.3
 */
protected Resource createResource(java.net.URI uri) {
	ResourceSet resourceSet = getResourceSet(null);
	URI emfUri = URI.createURI(uri.toString());
	configureResourceSet(resourceSet, emfUri);
	XtextResource resource = (XtextResource) resourceFactory.createResource(emfUri);
	resourceSet.getResources().add(resource);
	resource.setValidationDisabled(isValidationDisabled(uri));
	return resource;
}
 
Example 4
protected Resource createResourceFor(IStorage storage) throws CoreException {
	ResourceSet resourceSet = getResourceSet(storage);
	URI uri = URI.createPlatformResourceURI(storage.getFullPath().toString(), true);
	configureResourceSet(resourceSet, uri);
	URI uriForResource = uri; 
	if (!uri.isPlatform()) {
		uriForResource = resourceSet.getURIConverter().normalize(uri);
	}
	XtextResource resource = (XtextResource) resourceFactory.createResource(uriForResource);
	resourceSet.getResources().add(resource);
	resource.setValidationDisabled(isValidationDisabled(uri, storage));
	return resource;
}
 
Example 5
protected Resource createResource(IClassFile classFile) {
	URI uri = getClassFileSourceURI(classFile);
	IProject project = classFile.getJavaProject().getProject();
	ResourceSet resourceSet = getResourceSetProvider().get(project);
	XtextResource resource = (XtextResource) getResourceFactory().createResource(uri);
	resourceSet.getResources().add(resource);
	resource.setValidationDisabled(true);
	return resource;

}
 
Example 6
@Override
public XtextResource createResource() {
	ResourceSet resourceSet = resourceSetProvider.get(null);
	@SuppressWarnings("restriction")
	XtextResource result = (XtextResource) resourceSet.createResource(URI
			.createURI(org.eclipse.xtext.ui.codetemplates.ui.preferences.TemplateResourceProvider.SYNTHETIC_SCHEME + ":/" + "FormatterPreview.xtend"));
	result.setValidationDisabled(true);
	return result;
}