/**
  * Imports resources from <code>bundleSourcePath</code> inside <code>bundle</code> into <code>
  * importTarget</code>.
  *
  * @param importTarget the parent container
  * @param bundle the bundle
  * @param bundleSourcePath the path to a folder containing resources
  * @throws CoreException import failed
  * @throws IOException import failed
  */
 public static void importResources(
     IContainer importTarget, Bundle bundle, String bundleSourcePath)
     throws CoreException, IOException {
   Enumeration entryPaths = bundle.getEntryPaths(bundleSourcePath);
   while (entryPaths.hasMoreElements()) {
     String path = (String) entryPaths.nextElement();
     IPath name = new Path(path.substring(bundleSourcePath.length()));
     if (path.endsWith("/")) {
       IFolder folder = importTarget.getFolder(name);
       folder.create(false, true, null);
       importResources(folder, bundle, path);
     } else {
       URL url = bundle.getEntry(path);
       IFile file = importTarget.getFile(name);
       file.create(url.openStream(), true, null);
     }
   }
 }