mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
drop bundled groovy cache between vfs switching
GitOrigin-RevId: ec7aeda6f96acb228d2ade788eae0bf0a06e977e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b96989f195
commit
92093a94f4
@@ -1324,6 +1324,8 @@
|
||||
<notificationGroup id="Grape" displayType="BALLOON" bundle="messages.GroovyBundle" key="notification.group.grape"/>
|
||||
<newProjectWizard.language implementation="org.jetbrains.plugins.groovy.config.wizard.GroovyNewProjectWizard"/>
|
||||
<newProjectWizard.groovy.buildSystem implementation="org.jetbrains.plugins.groovy.config.wizard.IntelliJGroovyNewProjectWizard"/>
|
||||
|
||||
<persistentFsConnectionListener implementation="org.jetbrains.plugins.groovy.bundled.BundledGroovyPersistentFsConnectionListener"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.debugger">
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.plugins.groovy.GroovyFileType
|
||||
class BundledGroovyClassFinder(project: Project) : NonClasspathClassFinder(project, GroovyFileType.DEFAULT_EXTENSION) {
|
||||
|
||||
override fun calcClassRoots(): List<VirtualFile> {
|
||||
val root = bundledGroovyJarRoot ?: return emptyList()
|
||||
val root = bundledGroovyJarRoot.value.get() ?: return emptyList()
|
||||
return listOf(root)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,14 @@ package org.jetbrains.plugins.groovy.bundled
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.ClearableLazyValue
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.openapi.util.Ref
|
||||
import com.intellij.openapi.util.io.JarUtil.getJarAttribute
|
||||
import com.intellij.openapi.vfs.JarFileSystem
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFsConnectionListener
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.GlobalSearchScopesCore
|
||||
import groovy.lang.GroovyObject
|
||||
@@ -28,7 +31,7 @@ private fun doGetBundledGroovyFile(): File {
|
||||
return File(jarPath)
|
||||
}
|
||||
|
||||
val bundledGroovyJarRoot: VirtualFile? by lazy(::doGetBundledGroovyRoot)
|
||||
val bundledGroovyJarRoot: ClearableLazyValue<Ref<VirtualFile>> = ClearableLazyValue.create { Ref.create(doGetBundledGroovyRoot()) }
|
||||
|
||||
private fun doGetBundledGroovyRoot(): VirtualFile? {
|
||||
val jar = bundledGroovyFile
|
||||
@@ -37,6 +40,12 @@ private fun doGetBundledGroovyRoot(): VirtualFile? {
|
||||
}
|
||||
|
||||
fun createBundledGroovyScope(project: Project): GlobalSearchScope? {
|
||||
val root = bundledGroovyJarRoot ?: return null
|
||||
val root = bundledGroovyJarRoot.value.get() ?: return null
|
||||
return GlobalSearchScopesCore.directoryScope(project, root, true)
|
||||
}
|
||||
|
||||
internal class BundledGroovyPersistentFsConnectionListener: PersistentFsConnectionListener {
|
||||
override fun beforeConnectionClosed() {
|
||||
bundledGroovyJarRoot.drop()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user