private void handleChangesOnDisk() {

		int choice = OptionDialog.showOptionDialog(scrollPane, FILE_ON_DISK_CHANGED_TITLE,
			"<html>The contents of the script file have changed on disk.<br><br>Would " +
				"you like to <b>keep your changes</b> in the editor or <b><font color=\"" +
				Colors.ERROR.toHexString() + "\">" + "discard</font></b> your changes?",
			KEEP_CHANGES_TEXT, DISCARD_CHANGES_TEXT, OptionDialog.QUESTION_MESSAGE);

		if (choice == OptionDialog.CANCEL_OPTION) {
			// Cancel
			return;
		}

		if (choice == OptionDialog.OPTION_TWO) {
			// Discard Changes!
			reloadScript();
			return;
		}

		// implicit: choice == OptionDialog.OPTION_ONE

		//
		// The user wants to keep the changes, but how?
		//
		choice = OptionDialog.showOptionDialog(scrollPane, CHANGE_DESTINATION_TITLE,
			"<html>You can save your current changes to <b>another file</b> or " +
				"<b><font color=\"" + Messages.ERROR.toHexString() +
				"\">overwrite</font></b> the contents of the file on disk.",
			SAVE_CHANGES_AS_TEXT, OVERWRITE_CHANGES_TEXT, OptionDialog.QUESTION_MESSAGE);

		//
		// Cancel
		//
		if (choice == OptionDialog.CANCEL_OPTION) {
			// Cancel
			return;
		}

		//
		// Save As...
		//
		ResourceFile previousFile = scriptSourceFile;
		if (choice == OptionDialog.OPTION_ONE) {
			// Save As...
			if (saveAs()) {
				// Save As completed successfully; open a new editor
				// with the original file
				provider.editScriptInGhidra(previousFile);
			}

			return;
		}

		//
		// Overwrite changes on disk with a normal save operation
		//
		doSave();
	}
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