I am developing an Eclipse Plugin creating a new Project Wizard. When creating such new project in the workspace I need it to copy a folder, and its descendent, from the plugin to the just created project in the workspace. The problem is that while the project is an IResource
the plugin folder is in the file system.
I succeeded in getting an URL for the source plugin folder I need to copy and I have the IProject reference.
What I need to know is: How to copy the former into the latter?
This is not possible without knowing exactly the files (you cannot iterate over the children). Instead of using a folder with files and subfolders, create a zip with that structure and unpack the zip in your workspace (this should preserve the desired structure).
Check out this answer to see how to get a file/folder "out of" a plugin.
Then create new files/folders in the projects and set file contents using
InputStream
: