mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] Don't use project as disposable
Introduces `JavaPluginDisposable` and migrates existing project disposables to the new project level service. #IDEA-383890 Fixed GitOrigin-RevId: 762429b8f44959e127324d19053a8b05a818f414
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f1811ad257
commit
b9b383c76e
@@ -0,0 +1,24 @@
|
||||
// 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.java
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
* A project level disposable for the Java plugin.
|
||||
* Use this class instead of passing [Project] as a disposable to make sure your resource gets disposed when the Java plugin is unloaded.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@Service(Service.Level.PROJECT)
|
||||
class JavaPluginDisposable(val coroutineScope: CoroutineScope) : Disposable {
|
||||
override fun dispose() { }
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(project: Project): JavaPluginDisposable = project.service<JavaPluginDisposable>()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user