79722633

Date: 2025-08-01 14:26:21
Score: 0.5
Natty:
Report link

If you have the absolute path to the file the following is likely what you want:

Path path = new Path("D:\\test\\testfile.txt"))
IFile ifile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);

... where Path is org.eclipse.core.runtime.Path. Bit easier that iterating, even though in @greg-449 's answer you should only have one entry in the array ;-)

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @greg-449
Posted by: Dave Carpeneto