Exemple #1
0
 @Override
 public void removeAllWidgets() {
   try {
     java.awt.Component[] comps = getComponents();
     setVisible(false);
     for (int i = 0; comps.length != i; i++) {
       if (comps[i] instanceof WidgetWrapper) {
         WidgetWrapper wrapper = (WidgetWrapper) comps[i];
         if (wrapper.widget() != viewWidget) {
           removeWidget(wrapper);
         }
       }
     }
   } catch (RuntimeException ex) {
     org.nlogo.util.Exceptions.handle(ex);
   } finally {
     setVisible(false);
   }
 }
Exemple #2
0
 // this had to be made public so that workspace.Evaluator could call it when
 // running command thunks. - JC 6/11/10
 public void runtimeError(Exception ex) {
   try {
     Instruction instruction = null;
     Context context = null;
     if (ex instanceof EngineException) {
       instruction = ((EngineException) ex).instruction();
       context = ((EngineException) ex).context();
     }
     if (instruction == null) {
       instruction = activation.procedure().code()[ip];
     }
     if (context == null) {
       context = this;
     }
     activation.procedure().code()[ip].workspace.runtimeError(job.owner, context, instruction, ex);
   } catch (RuntimeException ex2) {
     // well we tried to report the original exception to the user,
     // but a new exception happened. so we'll report the original
     // using plan B. - ST 8/29/07
     org.nlogo.util.Exceptions.handle(ex);
   }
 }