Eclipse插件开发----------File转换为IFile

 

刚才经过不懈努力终于解决了,供初学者及同样由此问题的朋友参考:

IPath path = new Path(temp.getFilePath());
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("
此处为项目名");
String relativePath = path.toString().substring(project.getLocation().toString().length() + 1);
IFile file = project.getFile(relativePath);

你可能感兴趣的:(eclipse)