public void machineStateChanged(MachineStateChangeEvent evt) {
   MachineState state = evt.getState();
   if (!state.isConnected() || state.getState() == MachineState.State.RESET) {
     if (updateThread != null) {
       updateThread.interrupt();
     }
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             dispose();
           }
         });
   }
 }
 public void machineStateChanged(MachineStateChangeEvent evt) {
   MachineState state = evt.getState();
   // TODO: Do we handle reset correctly?
   if (state.isBuilding() || !state.isConnected()) {
     if (updateThread != null) {
       updateThread.interrupt();
     }
     if (pollThread != null) {
       pollThread.interrupt();
     }
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             dispose();
           }
         });
   }
 }