Extending com.intellij.execution.configurations.RunConfigurationOptions in Java Plugin Implementation

Answered

I'm developing a Run Configuration for Intellij IDEA. I have extended the com.intellij.execution.configurations.RunConfigurationOptions for the RunConfigurationOptions but none of the my options are persisted into the JDOM element. When debuging i found out that com.intellij.execution.configurations.RunConfigurationOptions and its subtypes which are kotlin classes uses something called property delegates. How can i implement this to work in Java ?

0
3 comments

I would suggest to use kotlin class for serialization. What is your base class for run configuration?

1

Yes the kotlin class option works perfect. i took that root and implement the plugin without any further problems. Thanks

0

I tried with kotlin but still not working. What am I missing?

import com.intellij.execution.configurations.RunConfigurationOptions

class JBossRunConfigurationOptions : RunConfigurationOptions() {

    private val emptyString = ""
    private val jbossHomePathProperty =
        string(emptyString).provideDelegate(this, "jbossHomePathProperty")
    private val standaloneXmlPathProperty =
        string(emptyString).provideDelegate(this, "standaloneXmlPathProperty")
    private val jdkHomePathProperty = string(emptyString).provideDelegate(this, "jdkHomePathProperty")

    fun getJbossHomePath(): String {
        return jbossHomePathProperty.getValue(this)!!
    }

    fun setJbossHomePath(value: String) {
        jbossHomePathProperty.setValue(this, value)
    }

    fun getStandaloneXmlPath(): String {
        return standaloneXmlPathProperty.getValue(this)!!
    }

    fun setStandaloneXmlPath(value: String) {
        standaloneXmlPathProperty.setValue(this, value)
    }

    fun getJdkHomePath(): String {
        return jdkHomePathProperty.getValue(this)!!
    }

    fun setJdkHomePath(value: String) {
        jdkHomePathProperty.setValue(this, value)
    }

}
0

Please sign in to leave a comment.