capint
8/4/2016 - 4:34 PM

EMF >> URI >> Get IFile from EMF resource

EMF >> URI >> Get IFile from EMF resource

EObject eObject = ...;
Resource eResource = eObject.eResource();
URI eUri = eResource.getURI();
if (eUri.isPlatformResource()) {
String platformString = eUri.toPlatformString(true);
IFile file = ResourcesPlugin.getWorkspace().getRoot().findMember(platformString);