final NbGradleProject gradleProject = project.getLookup().lookup(NbGradleProject.class);
if (gradleProject == null) {
throw new IllegalArgumentException("Not a Gradle project: " + project.getProjectDirectory());
}
gradleProject.ensureLoadRequested();
return gradleProject;
} catch (Throwable ex) {
throw Exceptions.throwUnchecked(ex);
}