示例#1
0
 /** opens a model from a file path. */
 public void openFromPath(String path, ModelType modelType) throws java.io.IOException {
   try {
     String source = org.nlogo.api.FileIO.file2String(path);
     if (source == null) {
       throw new IllegalStateException("couldn't open: '" + path + "'");
     }
     openFromSource(source, path, "Loading...", modelType);
   } catch (UserCancelException ex) {
     org.nlogo.util.Exceptions.ignore(ex);
   }
 }
示例#2
0
 public void run() {
   try {
     org.nlogo.api.FileIO.writeFile(path, modelSaver.save());
     new org.nlogo.window.Events.ModelSavedEvent(path).raise(FileMenu.this);
   } catch (java.io.IOException ex) {
     result = false;
     exception = ex;
     // we don't want to call JOptionPane.showMessageDialog() here
     // because Java on Macs tends to barf when multiple modal dialogs
     // appear on top of each other, so we just hang onto the exception
     // until the modal progress task is done... - ST 11/3/04
   }
 }