In eclipse API, How to get IFile from file that lo

2019-05-15 10:41发布

I want to create IFile interface to open file that locate outside project or workspace.

How to get IFile interface?

Regards, Simon

1条回答
Viruses.
2楼-- · 2019-05-15 10:48

http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace%3F

You can create a linked resource:

IPath location = new Path(name);
IFile file = project.getFile(location.lastSegment());
file.createLink(location, IResource.NONE, null);

Or, if you can use the EFS interface (since Eclipse 3.3), you can use that instead of IFile.

查看更多
登录 后发表回答