[settingsSync] added SettingsSyncCommunicatorProvider.isAvailable

(cherry picked from commit 15f48b82f639c89aee0f25343f9c2306e16e4167)

IJ-CR-154861

GitOrigin-RevId: 5854a8461a79b8f22af213d2487467a3e5120612
This commit is contained in:
Sergey Pak
2025-02-11 21:51:53 +01:00
committed by intellij-monorepo-bot
parent 4e157689c8
commit 0c4475b506
3 changed files with 7 additions and 4 deletions

View File

@@ -78,7 +78,7 @@ object RemoteCommunicatorHolder : SettingsSyncEventListener {
fun getAvailableProviders(): List<SettingsSyncCommunicatorProvider> { fun getAvailableProviders(): List<SettingsSyncCommunicatorProvider> {
val extensionList = arrayListOf<SettingsSyncCommunicatorProvider>() val extensionList = arrayListOf<SettingsSyncCommunicatorProvider>()
extensionList.addAll(SettingsSyncCommunicatorProvider.PROVIDER_EP.extensionList) extensionList.addAll(SettingsSyncCommunicatorProvider.PROVIDER_EP.extensionList.filter { it.isAvailable() })
if (extensionList.find { it.providerCode == DEFAULT_PROVIDER_CODE } == null) { if (extensionList.find { it.providerCode == DEFAULT_PROVIDER_CODE } == null) {
extensionList.add(DummyDefaultCommunicatorProvider) extensionList.add(DummyDefaultCommunicatorProvider)
} }

View File

@@ -21,6 +21,11 @@ interface SettingsSyncCommunicatorProvider {
*/ */
fun createCommunicator(userId: String): SettingsSyncRemoteCommunicator? fun createCommunicator(userId: String): SettingsSyncRemoteCommunicator?
/**
* Indicates whether provider is available. Allows to control provider availability inside the plugin
*/
fun isAvailable(): Boolean = true
companion object { companion object {
@JvmField @JvmField
val PROVIDER_EP = ExtensionPointName.create<SettingsSyncCommunicatorProvider>("com.intellij.settingsSync.communicatorProvider") val PROVIDER_EP = ExtensionPointName.create<SettingsSyncCommunicatorProvider>("com.intellij.settingsSync.communicatorProvider")

View File

@@ -22,7 +22,5 @@ class JbaCommunicatorProvider : SettingsSyncCommunicatorProvider, Disposable {
CloudConfigServerCommunicator(null, authServiceLazy.value) CloudConfigServerCommunicator(null, authServiceLazy.value)
}.value }.value
override fun dispose() { override fun dispose() {}
TODO("Not yet implemented")
}
} }