private <T extends DomainObject> boolean applyCommand(Command<T> cmd, T domainObject) {

		boolean success = false;
		boolean error = false;
		String cmdName = cmd.getName();
		int txId = domainObject.startTransaction(cmdName);
		try {
			try {
				success = cmd.applyTo(domainObject);

				// Schedule empty background task to trigger flushEvents and processing of 
				// resulting queued commands.  This is standard behavior when any
				// BackgroundCommand completes its execution (see taskCompleted method).
				executeCommand(new EmptyBackgroundCommand<T>(cmdName), domainObject);
			}
			catch (Throwable t) {
				error = true;
				clearQueuedCommands(domainObject);
				if (t instanceof DomainObjectException) {
					t = t.getCause();
				}

				// these are not 'unexpected', so don't show the user
				if (t instanceof ConnectException) {
					return false;
				}
				if (t instanceof RollbackException) {
					return false;
				}

				Msg.showError(this, null, "Command Failure",
					"An unexpected error occurred running command: " + cmd.getName(), t);
			}
		}
		finally {
			domainObject.endTransaction(txId, !error);
		}

		return success;
	}
Execute the given command in the foreground.  Required domain object transaction will be
started with delayed end to ensure that any follow-on analysis starts prior to transaction 
end.

@param cmd command to execute
@param obj domain object to which the command will be applied
@return the completion status of the command

@see Command#applyTo(DomainObject)
Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/mgr/ToolTaskManager.java