Eclipse Monkey Overview
Eclipse Monkey allows you to write scripts that run inside Eclipse.
Eclipse Monkey Help
Getting the Source
The recommended method is to use Buckminster. 
If that doesn't work you can get the code with anonymous CVS:
Monkey Help covers the basics of running and writing scripts.
Basic interaction with the Eclipse editor can be done using the built in DOM. The main component is the Editor.