private void doSave() {
		String text = textArea.getText();

		try {
			PrintWriter writer = new PrintWriter(new FileWriter(scriptSourceFile.getFile(false)));
			writer.print(text);
			writer.close();
			clearChanges();
			provider.getTable().repaint();
			refreshAction();
		}
		catch (IOException e) {
			if (scriptSourceFile.canWrite()) {
				Msg.showError(getClass(), getComponent(), "Error saving script", e.getMessage());
			}
			else {
				Msg.showError(getClass(), getComponent(), "Error saving script",
					"The file is not writable.");
			}
		}

		provider.scriptUpdated(scriptSourceFile);
	}
Returns false if the user cancels--meaning they did not make a decision regarding the
file (or 'handle' it).
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptEditorComponentProvider.java