In eclipse API, How to get IFile from file that locate outside project or workspace

情到浓时终转凉″ 提交于 2019-12-10 10:12:28

问题


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

How to get IFile interface?

Regards, Simon


回答1:


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.



来源:https://stackoverflow.com/questions/624897/in-eclipse-api-how-to-get-ifile-from-file-that-locate-outside-project-or-worksp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!