@Override
	public boolean applyTo(Program program, TaskMonitor monitor) {

		Memory mem = program.getMemory();

		if (!program.hasExclusiveAccess()) {
			setStatusMsg("Exclusive access required");
			return false;
		}

		monitor.initialize(blockAddresses.length);
		for (Address blockAddresse : blockAddresses) {
			if (monitor.isCancelled()) {
				break;
			}

			MemoryBlock block = mem.getBlock(blockAddresse);
			monitor.setMessage("Deleting block '" + block.getName() + "'...");

			try {
				mem.removeBlock(block, monitor);
			}
			catch (LockException e) {
				Msg.debug(this,
					"Unable to delete block--do not have lock: '" + block.getName() + "'", e);
			}
			monitor.initialize(block.getSize());
		}
		status = true;
		return status;
	}
Creates a background command for deleting memory blocks. Each address in
the array of block addresses indicates that the block containing that
address should be removed.
After the command has completed, getStatus() can be called to check the success.
If unsuccessful, getStatusMsg() can be called to get a message 
indicating why the command failed.
@param blockAddresses addresses indicating each block to be removed.
@param listener listener that will be notified when the delete block has completed.
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/memory/DeleteBlockCmd.java