UndoRefactoringElementListener: Not enabled for move refactoring?

I’m using com.intellij.execution.configurations.RefactoringListenerProvider#getRefactoringElementListener to update a run configuration when a file referenced by a run configuration is renamed or moved.

The “Undo” for a move refactoring doesn’t work, though.

Platform code usually implements RefactoringElementAdapter for the method above, which implements UndoRefactoringElementListener.
Platform code seems to assume that the undo part is called for both rename and move.

But in my testing, it doesn’t work reliably. Tested with my own and also a Java run configuration.

  • Undo after rename: undoElementMovedOrRenamed is called
  • Undo after move: undoElementMovedOrRenamed is NOT called

I’ve tested 2022.1 to 2025.1 and undo after move does not work, it’s never called.
This breaks run configurations if undo after move is called.

Is this a bug or intentional?

Is there a way to fix this in a plugin?