Saturday, May 16, 2009

Programmatically import an existing project into Eclipse

IProjectDescription description = ResourcesPlugin
   .getWorkspace().loadProjectDescription(        new Path("PROJECT_PATH/.project"));IProject project = ResourcesPlugin.getWorkspace()
   .getRoot().getProject(description.getName());
project.create(description, null);
project.open(null);

6 comments:

  1. Very helpful. Thanks!

    -Val

    ReplyDelete
  2. If it's an archive project ?

    ReplyDelete
  3. I recieve the following error: Exception in thread "main" java.lang.IllegalStateException: Workspace is closed.

    Do you know if there is a workaround for this.

    ReplyDelete
  4. Answers on stackoverflow.com may help: http://stackoverflow.com/questions/962364/workspace-is-closed-exception-when-trying-to-get-the-workspace-through-resources

    ReplyDelete