[gradle][IDEA-378369] do not show the "Download Sources" button in the editor for libraries provided by Gradle

GitOrigin-RevId: edb93cd092c44aac4348c80381b3cfcd83700038
This commit is contained in:
Alexander.Glukhov
2025-12-18 22:49:27 +00:00
committed by intellij-monorepo-bot
parent feca4c4016
commit 9252254775
6 changed files with 148 additions and 4 deletions
@@ -0,0 +1,31 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.roots.LibraryOrderEntry
import com.intellij.psi.PsiFile
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
interface AttachSourcesProviderFilter {
/**
* Checks can be an instance of AttachSourcesProvider applied to the specific PsiFile.
*/
fun isApplicable(provider: AttachSourcesProvider, orderEntries: List<LibraryOrderEntry>, psiFile: PsiFile): Boolean
companion object {
private val EP_NAME: ExtensionPointName<AttachSourcesProviderFilter> = ExtensionPointName("com.intellij.attachSourcesProviderFilter")
@JvmStatic
fun isProviderApplicable(provider: AttachSourcesProvider, orderEntries: List<LibraryOrderEntry>, psiFile: PsiFile): Boolean {
var applicable = true
EP_NAME.forEachExtensionSafe {
if (!it.isApplicable(provider, orderEntries, psiFile)) {
applicable = false
}
}
return applicable
}
}
}