Remove code duplication between TransformEditor.cpp and UndoCommands.cpp.