boolean (@Nullable Project project, @Nullable File file) { if (file == null) { return false; } if (project == null) { ProjectManager projectManager = ProjectManager.getInstance(); Project[] openProjects = projectManager.getOpenProjects(); project = openProjects.length > 0 ? openProjects[0] : projectManager.getDefaultProject(); } for (ExternalSystemExecutionAware executionAware : ExternalSystemExecutionAware.getExtensions(GradleConstants.SYSTEM_ID)) { if (!(executionAware instanceof GradleExecutionAware gradleExecutionAware)) continue; if (gradleExecutionAware.isGradleInstallationHomeDir(project, file.getPath())) { return true; } } return false; }