If you wanted to access the external eclipse project resources without really adding them into eclipse workspace, below piece code will help to do that.
privagte void linkProject(String projectPath) throws CoreException {
IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription( new Path(projectPath + File.separator +".project"));
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
project.create(description, IProject.FORCE, null);
if (!project.isOpen()) {
project.open(null);
}
}
privagte void linkProject(String projectPath) throws CoreException {
IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription( new Path(projectPath + File.separator +".project"));
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
project.create(description, IProject.FORCE, null);
if (!project.isOpen()) {
project.open(null);
}
}
No comments:
Post a Comment