[platform] IJPL-163405: Move FrontendApplicationInfo to the platform classloader

See IJPL-163613 for more info

GitOrigin-RevId: 121e07010a874aaf4dc4f564b95cae87dfb7e8df
This commit is contained in:
Nikolay Rykunov
2024-10-07 11:47:44 +02:00
committed by intellij-monorepo-bot
parent be1f7ce80b
commit 7055a5b572
3 changed files with 79 additions and 39 deletions

View File

@@ -1,40 +1,38 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.frontend
import com.intellij.openapi.util.Key
import com.intellij.util.application
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
object FrontendApplicationInfo {
val frontendTypeDataKey = Key<FrontendType>("platform.frontend.type")
/**
* Determines the type of the frontend.
*
* Use this function as rare as possible and only for temporary solutions.
* Ideally, code should not work conditionally based on the [FrontendType].
*/
fun getFrontendType(): FrontendType {
// [frontendTypeDataKey] is put by thin client (RemoteDev and Code With Me), otherwise it is Monolith
return application.getUserData(frontendTypeDataKey) ?: FrontendType.Monolith
}
}
/**
* Enum representing different types of IntelliJ Platform Frontends.
* Namely:
* - Monolith: Represents a single process IDE.
* - RemoteDev: Represents a frontend in a remote development and Code With Me client.
*/
@ApiStatus.Internal
sealed interface FrontendType {
object Monolith : FrontendType
/**
* Represents a frontend in a remote development and Code With Me client.
*
* @property isLuxSupported Indicates whether the frontend supports LUX (transferring UI from host to the client).
*/
data class RemoteDev(val isLuxSupported: Boolean) : FrontendType
}
// TODO: uncomment it when IJPL-163613 is fixed
// now it is moved to intellij.platform.ide.impl module see com.intellij.frontend.FrontendApplicationInfo
//@ApiStatus.Internal
//object FrontendApplicationInfo {
// val frontendTypeDataKey = Key<FrontendType>("platform.frontend.type")
//
// /**
// * Determines the type of the frontend.
// *
// * Use this function as rare as possible and only for temporary solutions.
// * Ideally, code should not work conditionally based on the [FrontendType].
// */
// fun getFrontendType(): FrontendType {
// // [frontendTypeDataKey] is put by thin client (RemoteDev and Code With Me), otherwise it is Monolith
// return application.getUserData(frontendTypeDataKey) ?: FrontendType.Monolith
// }
//}
//
///**
// * Enum representing different types of IntelliJ Platform Frontends.
// * Namely:
// * - Monolith: Represents a single process IDE.
// * - RemoteDev: Represents a frontend in a remote development and Code With Me client.
// */
//@ApiStatus.Internal
//sealed interface FrontendType {
// object Monolith : FrontendType
//
// /**
// * Represents a frontend in a remote development and Code With Me client.
// *
// * @property isLuxSupported Indicates whether the frontend supports LUX (transferring UI from host to the client).
// */
// data class RemoteDev(val isLuxSupported: Boolean) : FrontendType
//}

View File

@@ -0,0 +1,42 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.frontend
import com.intellij.openapi.util.Key
import com.intellij.util.application
import org.jetbrains.annotations.ApiStatus
// TODO: move to intellij.platform.frontend when IJPL-163613 is fixed
// This class should be used only in frontend parts
@ApiStatus.Internal
object FrontendApplicationInfo {
val frontendTypeDataKey = Key<FrontendType>("platform.frontend.type")
/**
* Determines the type of the frontend.
*
* Use this function as rare as possible and only for temporary solutions.
* Ideally, code should not work conditionally based on the [FrontendType].
*/
fun getFrontendType(): FrontendType {
// [frontendTypeDataKey] is put by thin client (RemoteDev and Code With Me), otherwise it is Monolith
return application.getUserData(frontendTypeDataKey) ?: FrontendType.Monolith
}
}
/**
* Enum representing different types of IntelliJ Platform Frontends.
* Namely:
* - Monolith: Represents a single process IDE.
* - RemoteDev: Represents a frontend in a remote development and Code With Me client.
*/
@ApiStatus.Internal
sealed interface FrontendType {
object Monolith : FrontendType
/**
* Represents a frontend in a remote development and Code With Me client.
*
* @property isLuxSupported Indicates whether the frontend supports LUX (transferring UI from host to the client).
*/
data class RemoteDev(val isLuxSupported: Boolean) : FrontendType
}

View File

@@ -8,8 +8,8 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.util.registry.Registry
import com.intellij.platform.debugger.impl.frontend.evaluate.quick.common.RemoteValueHint
import com.intellij.platform.debugger.impl.frontend.withCurrentDb
import com.intellij.platform.frontend.FrontendApplicationInfo
import com.intellij.platform.frontend.FrontendType
import com.intellij.frontend.FrontendApplicationInfo
import com.intellij.frontend.FrontendType
import com.intellij.platform.kernel.withKernel
import com.intellij.platform.project.asEntity
import com.intellij.platform.project.projectId