Ejemplo n.º 1
0
 private String userChooseSavePath() throws UserCancelException {
   String newFileName = guessFileName();
   String newDirectoryName = null;
   if (app.workspace().getModelType() == ModelTypeJ.NORMAL()) {
     // we only default to saving in the model dir for normal and
     // models. for library and new models, we use the current
     // FileDialog dir.
     newDirectoryName = app.workspace().getModelDir();
   }
   org.nlogo.swing.FileDialog.setDirectory(newDirectoryName);
   String path =
       org.nlogo.swing.FileDialog.show(this, "Save As", java.awt.FileDialog.SAVE, newFileName);
   if (!path.endsWith("." + modelSuffix())) {
     path += "." + modelSuffix();
   }
   return path;
 }
Ejemplo n.º 2
0
 @Override
 void action() throws UserCancelException, java.io.IOException {
   offerSave();
   openFromPath(userChooseLoadPath(), ModelTypeJ.NORMAL());
 }