public class WorkspaceResourceLocator implements IResourceProxyVisitor { 
private String location; 
private String resourceName; 

private WorkspaceResourceLocator(String resourceLocation) { 
     this.location = resourceLocation; 
   this.resourceName = // find the resource name from the location 
public static IResource findResource(String absolutePath) throws CoreException { 
   WorkspaceResourceLocator fileLocator = new WorkspaceResourceLocator(absolutePa     th); 
  ResourcesPlugin.getWorkspace().getRoot().accept(fileLocator, IResource.NONE); 
  return fileLocator.locatedResource; 

public boolean visit(IResourceProxy proxy) throws CoreException { 
  // check if the name of the resource matches 
  if (proxy.getName().equals(resourceName)) { 
     locatedResource = proxy.requestResource(); 
    // apply your logic to find required resource 
    return false; 
return true;