Normall, this code is used for converting from File to Ifile:
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IPath location= Path.fromOSString(file.getAbsolutePath());
IFile ifile= workspace.getRoot().getFilesForLocation(location);
But this only works for java files within the project. How can I get the IFile when File file is not in the workspace (not in the project)?