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

The following examples show how to use org.eclipse.xtext.resource.XtextResource#setValidationDisabled() . 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: URIBasedStorageEditorInputFactory.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@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
Source File: JavaClassPathResourceForIEditorInputFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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
Source File: ResourceForIEditorInputFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @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
Source File: ResourceForIEditorInputFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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
Source File: XbaseResourceForEditorInputFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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
Source File: FormatterResourceProvider.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@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;
}