//2:
GradleImportOperation importOp = GradleImportOperation.importAll(rootFolder);
importOp.setEnableDependencyManagement(false);
importOp.setEnableDSLD(false);
ErrorHandler eh = ErrorHandler.forImportWizard();
importOp.perform(eh, new SubProgressMonitor(monitor, 1));
//3: add spring nature
addPringNature(importOp.getProjects(), eh, new SubProgressMonitor(monitor, 1));
eh.rethrowAsCore();
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}