Reputation: 1138
How can I get an IResource from an IFile or from an absolute path?
I tried with:
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
resource = root.findMember(file.getAbsolutePath());
But I get a null
value.
Upvotes: 0
Views: 450
Reputation: 111142
IFile
extends IResource
so if you have an IFile
you have an IResource
.
findMember
treats the path it is given as relative to the container (the workspace root in this case). So you can't use it to find a file given an absolute file path - you must use the findFilesForLocation
APIs for that.
Upvotes: 2
Reputation: 34137
IFile
extend IResource
, or with other words an IFile
is an IResource
.
Upvotes: 2