mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
[jps caches] Fix "Don't use Project as Disposable" in JpsServerAuthExtension#checkAuthenticated usages
GitOrigin-RevId: ab3193e92a13966e8abe5bc29d9d03e0120708df
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d7d32f92c7
commit
cf3dd94f78
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.compiler.cache
|
||||
|
||||
import com.intellij.compiler.cache.client.CompilerCacheServerAuthService
|
||||
import com.intellij.compiler.cache.client.JpsServerAuthExtension
|
||||
import com.intellij.compiler.cache.git.GitRepositoryUtil
|
||||
import com.intellij.compiler.cache.ui.CompilerCacheNotifications
|
||||
@@ -22,7 +23,7 @@ internal class CompilerCacheStartupActivity : ProjectActivity {
|
||||
thisLogger().debug("Not an Intellij project, JPS Caches will not be available")
|
||||
return
|
||||
}
|
||||
JpsServerAuthExtension.checkAuthenticated(project, project) {
|
||||
JpsServerAuthExtension.checkAuthenticated(CompilerCacheServerAuthService.getInstance(project), project) {
|
||||
thisLogger().info("User authentication for JPS Cache download complete successfully")
|
||||
}
|
||||
checkWindowsCRLF(project)
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.intellij.compiler.cache.client
|
||||
import com.intellij.compiler.cache.client.JpsServerAuthExtension.Companion.getInstance
|
||||
import com.intellij.compiler.cache.ui.CompilerCacheNotifications
|
||||
import com.intellij.notification.NotificationType
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.compiler.JavaCompilerBundle
|
||||
import com.intellij.openapi.components.Service
|
||||
@@ -14,7 +15,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class CompilerCacheServerAuthService(private val project: Project, private val scope: CoroutineScope) {
|
||||
class CompilerCacheServerAuthService(private val project: Project, private val scope: CoroutineScope) : Disposable {
|
||||
fun getRequestHeaders(): Map<String, String> {
|
||||
return getRequestHeaders(false)
|
||||
}
|
||||
@@ -32,7 +33,7 @@ class CompilerCacheServerAuthService(private val project: Project, private val s
|
||||
val authHeader = authExtension.getAuthHeader(force)
|
||||
if (authHeader == null) {
|
||||
scope.launch {
|
||||
JpsServerAuthExtension.checkAuthenticated(project, project) {
|
||||
JpsServerAuthExtension.checkAuthenticated(getInstance(project), project) {
|
||||
thisLogger().info("User authentication for JPS Cache download complete successfully")
|
||||
}
|
||||
}
|
||||
@@ -45,4 +46,7 @@ class CompilerCacheServerAuthService(private val project: Project, private val s
|
||||
@JvmStatic
|
||||
fun getInstance(project: Project): CompilerCacheServerAuthService = project.service()
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ interface JpsServerAuthExtension {
|
||||
if (authExtension == null) {
|
||||
val userData = project.getUserData(NOTIFICATION_SHOWN_KEY)
|
||||
if (userData == null) {
|
||||
project.putUserData(NOTIFICATION_SHOWN_KEY, java.lang.Boolean.TRUE)
|
||||
project.putUserData(NOTIFICATION_SHOWN_KEY, true)
|
||||
withContext(Dispatchers.EDT) {
|
||||
CompilerCacheNotifications.ATTENTION
|
||||
.createNotification(JavaCompilerBundle.message("notification.title.jps.caches.downloader"),
|
||||
|
||||
Reference in New Issue
Block a user