[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] convert URI to IFile

I want to convert a URI to an IFile. My solution looks like this:

public static IFile getIFileFromURI(URI uri){
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	URI rootUri = root.getLocationURI();
	uri = rootUri.relativize(uri);
	IPath path = new Path(uri.getPath());
	return root.getFile(path);
}

Is there a better solution? It doesn't satisfy me that it is dependent from the WorkspaceRoot.

greets
Jan