private boolean saveAs() {
		HelpLocation help = new HelpLocation(plugin.getName(), saveAction.getName());
		SaveDialog dialog = new SaveDialog(getComponent(), "Save Script", provider,
			scriptSourceFile, GhidraScriptUtil.getProvider(scriptSourceFile), help);
		if (dialog.isCancelled()) {
			return false;
		}

		ResourceFile saveAsFile = dialog.getFile();
		boolean exists = saveAsFile.exists();
		if (exists) {
			int result = OptionDialog.showYesNoDialog(getComponent(), getName(),
				"Do you want to OVERWRITE the following script:\n" + saveAsFile.getName());
			if (result != OptionDialog.OPTION_ONE) {
				return false;
			}
		}

		provider.enableScriptDirectory(saveAsFile.getParentFile());

		try {
			String str = textArea.getText();
			str = str.replaceAll(GhidraScriptUtil.getBaseName(scriptSourceFile),
				GhidraScriptUtil.getBaseName(saveAsFile));
			textArea.setText(str);

			PrintWriter writer = new PrintWriter(new FileWriter(saveAsFile.getFile(false)));
			writer.print(str);
			writer.close();

			provider.switchEditor(scriptSourceFile, saveAsFile);
			scriptSourceFile = saveAsFile;

			title = saveAsFile.getName();

			clearChanges();

			provider.sortScripts();
			return true;
		}
		catch (IOException e) {
			Msg.showError(getClass(), getComponent(), "Error saving as script", e.getMessage());
			return false;
		}
	}
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