public static <T, E extends Exception> T tx(Program p, ExceptionalSupplier<T, E> s) {
		int txId = p.startTransaction("Test - Function in Transaction");
		boolean commit = true;
		try {
			T t = s.get();
			p.flushEvents();
			waitForSwing();
			return t;
		}
		catch (Exception e) {
			commit = false;
			failWithException("Exception modifying program '" + p.getName() + "'", e);
		}
		finally {
			p.endTransaction(txId, commit);
		}
		return null;
	}
Provides a convenient method for modifying the current program, handling the transaction
logic and returning a result.

@param <T> the return type
@param <E> the exception type
@param p the program
@param s the code to execute
@return the supplier's return value
@see #modifyProgram(Program, ExceptionalCallback)
@see #modifyProgram(Program, ExceptionalFunction)
Ghidra/Features/Base/src/main/java/ghidra/test/AbstractGhidraHeadlessIntegrationTest.java