private GradleImportOperation createImportOperation(IProgressMonitor m)
     throws FastOperationFailedException, OperationCanceledException, CoreException {
   m.beginTask("Create re-import operation", 1);
   try {
     GradleRefreshPreferences prefs =
         gradleProjects.iterator().next().getRootProject().getRefreshPreferences();
     List<HierarchicalEclipseProject> projects =
         new ArrayList<HierarchicalEclipseProject>(gradleProjects.size());
     Set<HierarchicalEclipseProject> relatedProjectsSet =
         new HashSet<HierarchicalEclipseProject>();
     for (GradleProject gradleProject : gradleProjects) {
       projects.add(gradleProject.getGradleModel(m));
       relatedProjectsSet.addAll(gradleProject.getAllProjectsInBuild());
     }
     GradleImportOperation op =
         new GradleImportOperation(
             projects,
             false,
             GradleImportOperation.createProjectMapping(
                 prefs.getUseHierarchicalNames(),
                 Arrays.asList(
                     relatedProjectsSet.toArray(
                         new HierarchicalEclipseProject[relatedProjectsSet.size()]))));
     op.setQuickWorkingSet(null); // this option only meaningfull on initial import.
     op.setReimport(true);
     op.verify();
     return op;
   } finally {
     m.done();
   }
 }
 public void perform(ErrorHandler eh, IProgressMonitor m) {
   m.beginTask("Reimporting Gradle Projects", 3);
   try {
     if (!gradleProjects.isEmpty()) {
       GradleImportOperation op = createImportOperation(new SubProgressMonitor(m, 1));
       op.perform(eh, new SubProgressMonitor(m, 2));
     }
   } catch (FastOperationFailedException e) {
     eh.handleError(e);
   } catch (CoreException e) {
     eh.handleError(e);
   } finally {
     m.done();
   }
 }