private DataType getDataType(Program program, FunctionLocation loc) {
		if (program == null) {
			return null;
		}
		Listing listing = program.getListing();
		Function f = listing.getFunctionAt(loc.getAddress());
		if (f == null) {
			return null;
		}
		DataType dt = null;

		if (loc instanceof FunctionSignatureFieldLocation) {
			dt = f.getReturnType();
		}
		else {
			Variable var = getVariable(f, loc);
			if (var != null) {
				dt = var.getDataType();
			}
		}
		// if the data type is a pointer, dig out what it points to!
		if (dt instanceof Pointer) {
			Pointer pdt = (Pointer) dt;
			dt = pdt.getDataType();
		}
		return dt;
	}
<CODE>EditStructureAction</CODE> allows the user to edit a structure.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditStructureAction.java