I'm trying to create a Run configuration (specifically using AbstractPythonRunConfiguration) that relies on a Rest API of another system to get some data for the script execution. All is good and well until I get to the SettingsEditor implementation.
In the SettingsEditor, I want to let the users choose some values that it gets from the API in a comboBox. At this point, whenever the user selects a different item from the comboBox, the Apply button is still grayed out. After some debugging later I saw the apply button relies on the XML serialization of the run configuration in RunConfiguration#writeExternal(). This post sums it up.
Now, In my situation, I don't want to serialize the user choices. I want these settings to live as long as the IDE is open, and re-entered when the IDE is restarted. The reason is that the data I fetch is dynamic and can change between user sessions, and might contain sensitive data. Serializing it also means writing it to workspace.xml.
But if I don't save the configuration in writeExternal, the Apply button will never be enabled. If I select what I need and click OK, the settings are not saved.
The weird thing is when I use LazyRunConfigurationProducer to create a run configuration, It opens a configuration editor (because some parameters are mandatory in RunConfiguration#CheckConfiguration()), and the configuration I enter there is saved to the run configuration, Because the Apply button in this window is enabled by default, regardless of the state of the configuration. When I try to edit this configuration, again the apply button will never be enabled.
Any idea how I can save the config only to my run configuration instance, without serializing it?
Also, I'm using kotlin UI DSL in the SettingsEditor, maybe there's a way to use DialogPanel#onIsModified() or something else to achieve that?