Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 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.findrefs;
 
import  org.eclipse.core.resources.IProject;
import  org.eclipse.core.resources.IStorage;

Author(s):
Jan Koehnlein - Initial contribution and API
Since:
2.3
	public <R> R readOnly(URI targetURIIUnitOfWork<R, ResourceSetwork) {
		Iterable<Pair<IStorage, IProject>> storages = .getStorages(targetURI.trimFragment());
		Iterator<Pair<IStorage, IProject>> iterator = storages.iterator();
		while(iterator.hasNext()) {
			Pair<IStorage, IProject> pair = iterator.next();
			IProject project = pair.getSecond();
			if (project != null) {
				ResourceSet resourceSet = .get(project);
				if(resourceSet != null)
					resourceSet.getResource(targetURItrue);
					try {
						return work.exec(resourceSet);
catch (Exception e) {
						throw new WrappedException(e);
					}
			}
		}
		return null;
	}
New to GrepCode? Check out our FAQ X