IPath IFile IProject IWorkspace
String filePath = "\testP\src\context\test.html";
IPath path = new Path(filePath);
IWorkspaceRoot = root = ResourcesPlugin.getWorkspace().getRoot();
IProject ps[] = root.getProjects();
org.eclipse.core.resources.IFile
file = root.getFileForLocation(path
);
IProject = file.getProject();
root 是整个Workspace的根容器,它可以获取到子目录的文件。
和java.io.File不同的是IFile通常是get出来的,不是new出来的。
The Official Eclipse FAQs
http://wiki.eclipse.org/index.php/The_Official_Eclipse_FAQs