private int saveChangesForCloseEvent(boolean allowCancel) {
		// Check for changes and prompt user to check if saving them.
		if (hasChanges()) {
			String question = "The Enum Editor is closing.\n" + "Save the changes to " +
				editorPanel.getEnum().getDisplayName() + "?";
			String title = "Save Enum Editor Changes?";
			int response;
			if (allowCancel) {
				response = OptionDialog.showYesNoCancelDialog(editorPanel, title, question);
			}
			else {
				response = OptionDialog.showYesNoDialog(editorPanel, title, question);
			}
			if (response == OptionDialog.OPTION_ONE) {
				// YES selected.
				if (!applyChanges()) {
					return ERROR;
				}
			}
			return response;
		}
		return NO_SAVE; // no save required, or No selected
	}
Prompts the user if the editor has unsaved changes. Saves the changes if
the user indicates to do so.
@return CANCEL (0) if the user canceled;
  SAVE (1) if the user saved changes;
  NO_SAVE (2) if the user did not save changes or no save was required;
  ERROR (3) if there was an error when the changes were applied.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java