Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.editor.model;
 
import  org.eclipse.core.resources.IStorage;
import  org.eclipse.core.runtime.CoreException;
import  org.eclipse.core.runtime.IStatus;
import  org.eclipse.core.runtime.Status;
import  org.eclipse.jdt.core.IJarEntryResource;
import  org.eclipse.jdt.core.IJavaProject;
import  org.eclipse.jdt.core.IPackageFragmentRoot;

Author(s):
Michael Clay
Jan Koehnlein

Since:
2.5
	}
	protected Resource createResource(IStorage storagethrows CoreException {
		if (storage instanceof IJarEntryResource) {
			Resource result = createResourceFor((IJarEntryResource) storage);
			if (result == null) {
				throw new CoreException(new Status(IStatus.ERROR, ."Cannot create resource for storage with path " + storage.getFullPath()));
			}
			return result;
		}
		return super.createResource(storage);
	}
	protected Resource createResourceFor(IJarEntryResource storage) {
		ResourceSet resourceSet = getResourceSet(storage);
		URI uri = .getUri(storage);
		if (uri == null) {
			return null;
		}
		configureResourceSet(resourceSeturi);
		XtextResource resource = createResource(resourceSeturi);
		return resource;
	}

Since:
2.5
	protected boolean isValidationDisabled(URI uri, IStorage storage) {
		if (storage instanceof IJarEntryResource) {
			return true;
		}
		return super.isValidationDisabled(uristorage);
	}

Since:
2.4
	protected boolean isValidationDisabled(IStorage storage) {
		return isValidationDisabled(nullstorage);
	}
	protected ResourceSet getResourceSet(/* @Nullable */ IStorage storage) {
		if (storage instanceof IJarEntryResource) {
			IPackageFragmentRoot root = ((IJarEntryResource) storage).getPackageFragmentRoot();
			if (root != null) {
				IJavaProject project = root.getJavaProject();
				if (project != null)
					return getResourceSetProvider().get(project.getProject());
			}
		return super.getResourceSet(storage);
	}
New to GrepCode? Check out our FAQ X