Ejs and Molecular Workbench (MW) are two different projects. I am not sure that the source of MW can be helpful to Ejs, as there is no interface between the two.

The Newton Cradle example you cited was created using MW's graphical modeling environment (no programming was needed). It then runs within MW's generic classical mechanics simulation engine, which solves Newton's Second Law for any interacting particle system. There is no special source file associated with it, other than the setup that got saved when the model was designed with the GUI.

Hope this helps.