refs #8733. Extract to methods.

I have very limited time for refactoring this, and we are going to kill this gui completely anyway in the next release.