I took some old code that I wrote and trimmed it down to show you how I did something similar to what you are asking about. In my example I used your class names Editor and Engine. The main method is nested in class Editor. So scope on my code and tell me what you think:
Here is your Editor:
Here is your Engine code:
If anybody sees useless code that pertains directly to how to accomplish John's question please feel free to help me trim that fat. No need to point out stuff like "int x = 0". It's obvious that that isn't used. Please point out things that are needed, but can be reduced (ie general code format, etc).
John, let me know if this properly addresses your original question.