public void promptSave() { if (isModified) { Response resp = Dialogs.showYesNoDialog( sandboxStage.getStageForChooser(), "Save modified file?", "Save changes?"); if (resp == Response.YES) { saveFile(); } } }
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); } }