https://kotlinlang.org logo
#intellij-plugins
Title
# intellij-plugins
r

robercoding

02/25/2023, 2:00 PM
Hey new question 😄 I have a Configurable that has a Component using
Compose
desktop Whenever using Compose, once I enter the tab using
Compose
and then navigate to other tool tab, UI stays there and it's not hidden, If I use
FormBuilder.createFormBuilder()
this doesn't happen, does anyone know why is it happening with Compose? Code & pictures in 🧵
Hello stays there in the second picture:
Configurable:
Copy code
class AppSettingsConfigurable : Configurable {
    private var composeDemo: ComposeDemoComponent? = null

    @Nls(capitalization = Nls.Capitalization.Title)
    override fun getDisplayName(): String {
        return "SDK: Application Settings Example"
    }

    override fun getPreferredFocusedComponent(): JComponent? {
        return null
    }

    override fun createComponent(): JComponent? {
        println("CREATE UI COMPONENT ")
        composeDemo = ComposeDemoComponent()
        return composeDemo?.panel
    }

    override fun isModified(): Boolean {
        println("IS MODIFIED")
        return false
    }

    override fun cancel() {
        println("CANCEL")
        super.cancel()
    }

    override fun apply() {
        println("APPLY")
    }

    override fun reset() {
        println("RESET")
    }

    override fun disposeUIResources() {
        println("Dispose UI")
        composeDemo = null
    }
}
Component:
Copy code
class ComposeDemoComponent {
    val panel: JComponent

    init {
        panel = ComposePanel().apply {
            setContent {
                Text("hello")
            }
        }
    }
}
Plugin xml
Copy code
<extensions defaultExtensionNs="com.intellij">
        <applicationConfigurable
            parentId="tools"
            instance="com.jetbrains.compose.AppSettingsConfigurable"
            id="com.jetbrains.compose.AppSettingsConfigurable"
            displayName="SDK: Application Settings Example"

        />
    </extensions>
I don't see anything wrong, am I missing some specific configuration or some explicit code like
composeDemo.hide()
when tab changes or!?
Update: I'm not alone, seems to be an issue on mac OS bloodtrail https://github.com/JetBrains/compose-jb/issues/2656
5 Views