@SuppressWarnings("unchecked")
	private <T> T doAsk(Class<?> clazz, String key1, String key2, T defaultValue,
			CancellableFunction<T, T> asker) throws CancelledException {

		Map<Class<?>, Object> map = getScriptMap(key1, key2);

		T mappedValue = null;
		if (clazz != null && reusePreviousChoices) {
			mappedValue = (T) map.get(clazz);
		}

		T lastValue = (mappedValue != null) ? mappedValue : defaultValue;

		T newValue = swing(asker, lastValue); // may be cancelled

		map.put(clazz, newValue);
		return newValue;
	}
A generic method to execute user prompting for a value.  This method handles:
<ol>
	<li>Checking for a previously chosen value; using the optional <code>defaultValue</code> as a fallback</li>
	<li>Calling the provided function to execute the client-specific ask UI</li>
	<li>Storing the chosen result after the dialog is closed</li>
</ol>

@param clazz the type of the object for which the client is asking
@param key1 - the first key used to store/lookup chosen values (aka, 'title')
@param key2 - the second key used to store/lookup chosen values (aka, 'message'/'approveButtonText')
@param defaultValue - an optional value to be used as the pre-seed value in the 'asker'
                      callback.  This value will be passed if no previous value is found
@param asker - a function that will be called with the seed value derived from a previous
               choice and the given default value.
               This function is one in which you can throw a {@link CancelledException}
@return the user's choice

@throws CancelledException if the user cancels the ask operation
Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScript.java