Search in sources :

Example 1 with InternalGradleBuild

use of org.eclipse.buildship.core.internal.workspace.InternalGradleBuild in project eclipse.jdt.ls by eclipse.

the class GradleBuildSupport method isRoot.

private boolean isRoot(IProject project, GradleBuild gradleBuild, IProgressMonitor monitor) {
    if (gradleBuild instanceof InternalGradleBuild) {
        CancellationTokenSource tokenSource = GradleConnector.newCancellationTokenSource();
        Map<String, EclipseProject> eclipseProjects = ((InternalGradleBuild) gradleBuild).getModelProvider().fetchModels(EclipseProject.class, FetchStrategy.LOAD_IF_NOT_CACHED, tokenSource, monitor);
        File projectDirectory = project.getLocation().toFile();
        for (EclipseProject eclipseProject : eclipseProjects.values()) {
            File eclipseProjectDirectory = eclipseProject.getProjectDirectory();
            if (eclipseProjectDirectory.equals(projectDirectory)) {
                return eclipseProject.getParent() == null;
            }
        }
    }
    return false;
}
Also used : EclipseProject(org.gradle.tooling.model.eclipse.EclipseProject) InternalGradleBuild(org.eclipse.buildship.core.internal.workspace.InternalGradleBuild) CancellationTokenSource(org.gradle.tooling.CancellationTokenSource) File(java.io.File)

Aggregations

File (java.io.File)1 InternalGradleBuild (org.eclipse.buildship.core.internal.workspace.InternalGradleBuild)1 CancellationTokenSource (org.gradle.tooling.CancellationTokenSource)1 EclipseProject (org.gradle.tooling.model.eclipse.EclipseProject)1