/*
  * Copy the bundle with the given id to the specified location. (location
  * is parent directory)
  */
 public void copyBundle(String bundlename, File source, File destination) throws IOException {
   if (destination == null) destination = output;
   destination = new File(destination, "eclipse/plugins");
   if (source == null) {
     Bundle bundle = TestActivator.getBundle(bundlename);
     if (bundle == null) {
       throw new IOException("Could not find: " + bundlename);
     }
     String location = bundle.getLocation();
     if (location.startsWith("reference:")) location = location.substring("reference:".length());
     source = new File(FileLocator.toFileURL(new URL(location)).getFile());
   }
   destination = new File(destination, source.getName());
   if (destination.exists()) return;
   FileUtils.copy(source, destination, new File(""), false);
   // if the target of the copy doesn't exist, then signal an error
   assertTrue("Unable to copy " + source + " to " + destination, destination.exists());
 }