예제 #1
0
  public void promptSave() {
    if (isModified) {
      Response resp =
          Dialogs.showYesNoDialog(
              sandboxStage.getStageForChooser(), "Save modified file?", "Save changes?");

      if (resp == Response.YES) {
        saveFile();
      }
    }
  }
예제 #2
0
  private void saveFile() {
    if (sourceFile == null) {
      FileChooser fc = new FileChooser();
      fc.setTitle("Save file as");

      fc.setInitialDirectory(Sandbox.SANDBOX_SOURCE_DIR.toFile());

      sourceFile = fc.showSaveDialog(sandboxStage.getStageForChooser());
    }

    if (sourceFile != null) {
      saveFile(sourceFile);
      setModified(false);
    }
  }