在Eclipse API中,如何从位于项目或工作区外部的文件中获取IFile [英] In eclipse API, How to get IFile from file that locate outside project or workspace

查看:124
本文介绍了在Eclipse API中,如何从位于项目或工作区外部的文件中获取IFile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建IFile界面来打开位于项目或工作区外部的文件.

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

如何获取IFile接口?

How to get IFile interface?

关于, 西蒙

推荐答案

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

您可以创建一个链接的资源:

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

或者,如果可以使用EFS接口(从Eclipse 3.3开始),则可以使用该接口代替IFile.

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

这篇关于在Eclipse API中,如何从位于项目或工作区外部的文件中获取IFile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆