private void doCreateProject(ProjectCandidate pc, IProgressMonitor monitor)
     throws CoreException, InterruptedException, InvocationTargetException {
   HybridProjectCreator projectCreator = new HybridProjectCreator();
   Widget w = pc.getWidget();
   String projectName = pc.getProjectName();
   URI location = null;
   if (!copyFiles) {
     location = pc.wwwLocation.getParentFile().toURI();
   }
   IProject project =
       projectCreator.createProject(
           projectName,
           location,
           w.getName(),
           w.getId(),
           HybridMobileEngineManager.getDefaultEngine(),
           monitor);
   if (copyFiles) {
     ImportOperation operation =
         new ImportOperation(
             project.getFullPath(),
             pc.wwwLocation.getParentFile(),
             FileSystemStructureProvider.INSTANCE,
             this);
     operation.setContext(getShell());
     operation.setOverwriteResources(true);
     operation.setCreateContainerStructure(false);
     operation.run(monitor);
     IStatus status = operation.getStatus();
     if (!status.isOK()) throw new InvocationTargetException(new CoreException(status));
   }
 }
  private static void importProject(
      Shell shell,
      IImportStructureProvider provider,
      Object source,
      IPath path,
      boolean overwriteResources,
      boolean createContainerStructure,
      IProgressMonitor monitor)
      throws InvocationTargetException, InterruptedException {
    monitor.beginTask(
        Messages.getString("ImportProjectsUtilities.task.importingProject"), 1); // $NON-NLS-1$

    ArrayList fileSystemObjects = new ArrayList();
    ImportProjectsUtilities.getFilesForProject(fileSystemObjects, provider, source);

    ImportOperation operation =
        new ImportOperation(path, source, provider, new MyOverwriteQuery(), fileSystemObjects);
    operation.setContext(shell);
    operation.setOverwriteResources(overwriteResources);
    operation.setCreateContainerStructure(createContainerStructure);
    operation.run(new SubProgressMonitor(monitor, 1));
    monitor.done();
  }