SettingsEditor.applyEditorTo seems to be invoked repeatedly for no reason

I am working on implementing my SettingsEditor and have encountered a problem.

It seems that ‘applyEditorTo’ is being invoked repeatedly for no reason and without any button being pressed.
I expected it to only be called when the [OK] button was pressed.

I have implemented my Action Logger and get the following event when one of the buttons is pressed:

MyActionLogger: Action ‘EditRunConfigurationsAction’ ActionID=‘editRunConfigurations’ has been performed.
Should I use that information to determine which button is pressed ?

It seems that ‘applyEditorTo’ is being invoked repeatedly for no reason and without any button being pressed.
I expected it to only be called when the [OK] button was pressed.

That’s an incorrect assumption.
AFAIK the call in the background happens to enable the “apply” button only if there are changes. For such calls the target settings are not the actual, persisted run configuration settings.
That’s similar to the application preferences/settings.

MyActionLogger: Action ‘EditRunConfigurationsAction’ ActionID=‘editRunConfigurations’ has been performed.
Should I use that information to determine which button is pressed ?

No, I wouldn’t do that. In general, don’t try to outsmart the SDK or the API, it usually has a reason when something unexpected happens.

Which problem are you trying to actually solve? For example, a performance problem of “apply” os something else?

There’s also CheckableRunConfigurationEditor which would allow to implement lighter checks, but AFAIK there’s only one implementation in intellij-community.

I have implemented my editor using Properties that I write/read to .idea
When I am finished editing and press Ok/Cancel I want to update the .xml file only if Ok.

I’m not using PersistentStateComponent, should I?

Using PersistentStateComponent (when configured properly) allows users to import/export/migrate their configuration. I’m not sure it works when implementing your own solution.

There is a mini-tutorial on how to implement Run Configuration along with SettingsEditor.

The SettingsEditor vaguely resembles a “Controller” from MVC:

  • applyEditorTo() maps UI components to a domain object representing a set of settings.
  • resetEditorFrom() does the opposite - maps that domain object to UI components.

There is quite a complex logic and multiple flows why that applyEditorTo() is invoked, but the majority of implementations just move data back and forth between UI and domain object.

And importantly, Run Configuration Settings are persisted automatically. There is no need to use PersistentStateComponents.

I’ve tried following the ‘mini-tutorial’ you mention. Pure copy with just StoredProperty works perfectly fine.
however, if I add StoredProperty<Map<String, String>> it goes wrong

Everything goes well until I press OK, then I get

The plugin com.portablesimula.SimulaPlugin failed to save settings. Please restart IntelliJ IDEA
java.lang.Exception: Cannot get RunManager component state
at com.intellij.configurationStore.ComponentStoreImpl.commitComponents$suspendImpl(ComponentStoreImpl.kt:304)
at com.intellij.configurationStore.ComponentStoreImpl$commitComponents$1.invokeSuspend(ComponentStoreImpl.kt)
at _COROUTINE.BOUNDARY.(CoroutineDebugging.kt:42)
at com.intellij.configurationStore.StoreUtilKt.saveSettings(storeUtil.kt:109)
at com.intellij.configurationStore.StoreUtilKt$saveProjectsAndApp$2$1$1.invokeSuspend(storeUtil.kt:238)
at com.intellij.openapi.progress.impl.PlatformTaskSupport$withBackgroundProgressInternal$2$2.invokeSuspend(PlatformTaskSupport.kt:109)

How to you initialize that Map-based StoredProperty? Can you show the relevant settings class?

private final StoredProperty<Map<String, String>> options =
        this.<String, String>map() // "options" is the name of the XML tag/attribute
                .provideDelegate(this, "options"); // Delegate it to this object with the property name


Might it be an idea to add StoredProperty<Map<String, String>> to the mini-tutorial

The settings class:

DemoRunConfiguration ? or DemoRunConfigurationOptions ?

I have now updated to IntelliJ IDEA 2025.3 and the behavior is different.
When I update the StoredProperty<Map<String, String>> options I get no response. That is, the [Apply] button is not raised.
When I then press [Ok], only the first ‘StoredProperty’ is saved in the .xml file.

My DemoRunConfigurationOptions: WorkSpaces/Intellij/SimulaPlugin/src/main/java/simula/plugin/extensions/runConfiguration/DemoRunConfigurationOptions.java at main · portablesimula/WorkSpaces · GitHub
My runConfiguration dir: WorkSpaces/Intellij/SimulaPlugin/src/main/java/simula/plugin/extensions/runConfiguration at main · portablesimula/WorkSpaces · GitHub

Note: it is the ‘Demo…’ files that is used at present.